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.
```
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.
