Networking – Send TCP packets with Curl

batchcmd.execurlnetworkingtcp

Background :

I want to have computers communicate to each other so I used to use Dropbox for syncing them. I used one program to echo information in a text file, then the other computer would have an "if this then that" program. However, this took a long time to sync and I could not use the same method with a phone.

The Point :

I want to use curl to send text, images, audio clips, etc. (text for now). I used in batch curl 192.168.0.170:59403. That would work but on the receiving end it would say GET / HTTP/1.1\r\nHost: 192.168.0.170:59403\r\nUser-Agent: curl/7.53.1\r\nAccept: */*\r\n\r\n I want that to be text. Any Ideas?

Best Answer

You can send raw text with curl to any host:port as netcat would do, using the telnet protocol:

curl telnet://192.168.0.170:59403 <<< someText
Related Question