I have a program that uses UDP for inter process communication. I would like to setup python to listen for that program's data gram output and have my script send a copy of that data to any port it wishes. This needs to be two way communication such that my script can also communicate with the program. Example:
Program <----> Python
My code is below but it just hangs. Any ideas? It's not complete but I can't seem to capture any data sent from my program.
import socket
# Set up a UDP socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# send
HOSTNAME = '127.0.0.1'
#packet sniffer confirms data is comming into port 10000
PORTNO = 64637
s.connect((HOSTNAME, PORTNO))
MAXLEN = 1024
(data,addr) = s.recvfrom(MAXLEN)
s.close()
print data
Thanks!