Difference between sending data via UDP in Bash and with a Python script
- by Kevin Burke
I'm on a Centos box, trying to send a UDP packet to port 8125 on localhost. When I run this Python script:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto('blah', ("127.0.0.1", 8125))
The data appears where it should on port 8125. However when I send the data like this:
echo "blah" | nc -4u -w1 127.0.0.1 8125
…