UDP Timestamp Client (tsUclnt.py) : UDP Client : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » UDP Client »

 

UDP Timestamp Client (tsUclnt.py)


from socket import *

HOST = 'localhost'
PORT = 21567
BUFSIZ = 1024
ADDR = (HOST, PORT)

udpCliSock = socket(AF_INET, SOCK_DGRAM)

while True:
    data = 'data'
    if not data:
        break
    udpCliSock.sendto(data, ADDR)
    data, ADDR = udpCliSock.recvfrom(BUFSIZ)
    if not data:
        break
    print dataudpCliSock.close()

udpCliSock.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» UDP Client