September 16, 2015

Using netcat to send udp broadcast packet

1. You need to be root  on Linux
2. make sure you use the traditional netcat. In Ubuntu, that's nc.traditional
3. to send broadcast to broadcast address 192.168.1.255 port 8080, do this:

       echo -n "hello" | nc -b -u 192.168.1.255 8080 
4. OR, use ncat:

       echo -n "hello" | ncat -u 192.168.1.255 8080 

5. OR, use socat:
echo -n "hello" | socat - udp-datagram:192.168.1.255:8080,broadcast

No comments:

Post a Comment