python udp
import socket address = ('127.0.0.1', 5036) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: msg = raw_input() if not msg: break s.sendto(msg, address) s.close() import socket address = ('127.0.0.1', 5036) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(address) while True: data, addr = s.recvfrom(2048) if not data: print "client has exist" break print "received:", data, "from", addr s.close()