server.py
14 lines
| 348 B
| text/x-python
|
PythonLexer
r56 | import socket | |||
r59 | import time | |||
r56 | ||||
dgramSock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) | ||||
r59 | dgramSock.bind( ('192.168.1.117', 7000) ) | |||
r56 | ||||
while 1: | ||||
msg, (addr, port) = dgramSock.recvfrom( 100 ) | ||||
r59 | ||||
# time.sleep(30) #not ok at the client | ||||
# time.sleep(10) #ok | ||||
print msg + 'to: ' + addr + ':' + str (port) | ||||
r56 | dgramSock.sendto( msg, (addr, port) ) | |||