Python udp broadcast client-server example (previously)
Works for python 3.7 and 2.7 for Mac OS and Linux(kernel>=3.9) hosts. If you're using linux(kernel<3.9), then use socket.O_REUSEADDR
instead of socket.SO_REUSEPORT
to share (host, port)
between multiple clients and servers.
Tricks and traps:
- Socket portability issues: How do SO_REUSEADDR and SO_REUSEPORT differ?;
- Awesome "Socket Programming HOWTO";
Have a question? Make an issue :3