Skip to main content

You are here

Jeeudp -> display UDP messages on cli

1 post / 0 new
Jeeudp -> display UDP messages on cli

Playing for days with the ethernode, but did not understand the UDP multicast protocol. On Solaris I don't have a jeemon listener so I created / googled the following python solution. Perhaps you can use it.

Jeeudp sketch with UDP port set to 3000

#!/usr/bin/python import socket import struct import sys multicast_group = '' server_address = ('', 3000) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Bind to the server address sock.bind(server_address) # Add the socket to the multicast group on all interfaces. group = socket.inet_aton(multicast_group) mreq = struct.pack('4sL', group, socket.INADDR_ANY) sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) # Receive loop while True: print >>sys.stderr, '\nwaiting to receive message' data, address = sock.recvfrom(1024) print >>sys.stderr, 'received %s bytes from %s' % (len(data), address) print >>sys.stderr, repr(data) gives the following result: (I still have to check the output) waiting to receive message received 61 bytes from ('', 23456)


regards, Jeroen

Premium Drupal Themes by Adaptivethemes