Usually I always used netcat to send TCP data but there’s another way, builtin in bash. You can send the string “Hello world” to 192.168.1.1 on port 15123 using:
echo "Hello world" > /dev/tcp/192.168.1.1/15123
Simple, quick and effective :)
Note: thanks to Waldner for pointing out that it’s built-in in bash and there’s no need for an “mknode”
Let’s see if now I’m not caught by HTML formatting…
You don’t need the special /dev/tcp file. “/dev/tcp” is actually a special device name that is intercepted and parsed directly by bash.
See for example:
Waldner, I didn’t know it was a builtin… thanks a lot for the tip, I’ll update the post.
Handy code, thanks.