Last active
December 10, 2015 01:34
-
-
Save thomo/4359101 to your computer and use it in GitHub Desktop.
Script to send UDP packets to avr-netio (see http://handverdrahtet.blogspot.de/2012/12/avr-net-io-receive-udp-packets.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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