Skip to content

Instantly share code, notes, and snippets.

@teocci
Forked from mike-zhang/udpClient1.py
Created August 1, 2017 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocci/edfa9750f1be09df1a45e68cd6c1afb8 to your computer and use it in GitHub Desktop.
Save teocci/edfa9750f1be09df1a45e68cd6c1afb8 to your computer and use it in GitHub Desktop.
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