Created
November 26, 2013 05:04
-
-
Save kevinkirkup/7653716 to your computer and use it in GitHub Desktop.
Python UDP Server Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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