Skip to content

Instantly share code, notes, and snippets.

View cry's full-sized avatar
🤔
type confused

carey cry

🤔
type confused
View GitHub Profile
@cry
cry / client.py
Created September 4, 2018 01:45 — forked from ninedraft/README.md
Python udp broadcast client server example
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
client.bind(("", 37020))
while True:
data, addr = sock.recvfrom(1024)
print("received message: %s"%data)