Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a simple udp client (python code)
#! /usr/bin/python
# a simple udp client
import socket,time,traceback
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
dstHost = ('192.168.1.100', 12345)
while True:
try:
client.sendto('3',dstHost)
print time.time(),' : send success'
#print time.time()," : ",client.recv(1024)
time.sleep(3)
except:
traceback.print_exc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment