Skip to content

Instantly share code, notes, and snippets.

@thomo
Last active December 10, 2015 01:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomo/4359101 to your computer and use it in GitHub Desktop.
Save thomo/4359101 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import socket
# Set the socket parameters
# avr-netio ip address
host = "10.0.0.52"
# avr-netio port
port = 7777
addr = (host,port)
# Create socket
UDPSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
def_msg = "===Enter message to send ===";
print "\n",def_msg
# Send messages
while (1):
data = raw_input('>> ')
if not data:
break
else:
if(UDPSock.sendto(data,addr)):
print "Sending message '",data,"'....."
# Close socket
UDPSock.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment