Skip to content

Instantly share code, notes, and snippets.

@kevinkirkup
Created November 26, 2013 05:04
Show Gist options
  • Save kevinkirkup/7653716 to your computer and use it in GitHub Desktop.
Save kevinkirkup/7653716 to your computer and use it in GitHub Desktop.
Python UDP Server Example
'Show how to make a UDP server'
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 9601))
try:
while True:
msg, who = s.recvfrom(256)
print 'Received a call from: %r' % (who,)
print 'They said: %r' % msg
finally:
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment