5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ターミナルでTCP/UDP(osc)ネットワーク通信(Mac)

Last updated at Posted at 2020-02-19

HTTPリクエスト

Get

$ curl http://localhost:8080

Put

$ curl http://localhost:8080 -X PUT

Post

$ curl http://localhost:8080 -X Post

TCPでのメッセージ送受信

TCPでメッセージ送信

echo "hoge" | nc  127.0.0.1 8080

TCPで受信待ちする

$ nc -l 8080

TCP受信したらレスポンスを返す

$ (echo "HTTP/1.0 200 Ok"; echo; echo "Hello World") | nc -l 8080

永続的にTCPで受信待ちする

$ while true; do (echo "HTTP/1.0 200 Ok"; echo; echo "Hello World") | nc -l 8080; done

UDPでのメッセージ送受信

UDPでメッセージ送信

$ echo "hoge" | nc -u 127.0.0.1 8888

UDPで受信待ちする

$ nc -u -l 8888

OSCでメッセージ送受信 (oscer使用)

aikeさんのoscerがマルチプラットフォームで使用できてとても使いやすい

ダウンロード

OSCでメッセージ送信

$ oscer localhost 10000 /dummy
$ oscer 192.168.1.10 12000 /hello 10

OSCで受信待ちする

$ oscer receive 10000
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?