Unverified Commit 55738068 authored by Lucas Saavedra Vaz's avatar Lucas Saavedra Vaz Committed by GitHub

refactor(udp_server): Convert script from Python 2 to 3 (#9513)

parent 05967332
......@@ -6,17 +6,17 @@ import sys
try :
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
except socket.error, msg :
print 'Failed to create socket. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
except socket.error as msg :
print('Failed to create socket. Error Code : ' + str(msg[0]) + ' Message ' + msg[1])
sys.exit()
try:
s.bind(('', 3333))
except socket.error , msg:
print 'Bind failed. Error: ' + str(msg[0]) + ': ' + msg[1]
except socket.error as msg:
print('Bind failed. Error: ' + str(msg[0]) + ': ' + msg[1])
sys.exit()
print 'Server listening'
print('Server listening')
while 1:
d = s.recvfrom(1024)
......@@ -25,6 +25,6 @@ while 1:
if not data:
break
print data.strip()
print(data.strip())
s.close()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment