How do I write to a socket via curl? Need help with raw TCP communication! or Can you write to a sock

20 Replies, 1966 Views

Yep, you can write to a socket via curl! The `--telnet` option is what you’re looking for. Here’s a quick example:

```
echo "hello" | curl --telnet 127.0.0.1:8080
```

This sends raw TCP data. No HTTP headers, just pure bytes.

I’ve used it for testing a custom TCP server, and it worked fine. Just make sure your server’s listening on that port.

If you need more control, check out `nc` (netcat) too—it’s even better for raw socket stuff.

Messages In This Thread



Users browsing this thread: 1 Guest(s)