diff options
Diffstat (limited to 'tests/control.py')
-rw-r--r-- | tests/control.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/control.py b/tests/control.py new file mode 100644 index 0000000..0d27f14 --- /dev/null +++ b/tests/control.py @@ -0,0 +1,28 @@ +import socket +import time + +#Communication with the boards (for configuration) happens via UDP messages to 192.168.100.xxx at port 51966. IP range is 192.168.100.100 to 192.168.100.119. +#If you need to toggle the streaming on/off, send a udp broadcast to 192.168.100.255 at port 51966 with udp payload x011100 (disable) or x011101 (enable). +#To reset the internal packet counter to 1, send x011500 +#To change packet size, send x0112XXXX with XXXX being the payload size. Received packets will always be 8 byte larger than this value because of the counter in the beginning of the payload. You should change the size only when streaming is turned off. +#Currently, all 20 devices are streaming data packets of 800 byte size at a rate ~500 MBit/s per device. They send to ports 52067 through 52086. +#I'm pretty sure it was configured correctly when I left. Just in case, you can use command hex 0106XXXXXXXXXXX with the mellanox MAC in hex as XX to set the target Mac address for the devices. Broadcast it to port 51966 at 192.168.100.255. + + +server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) +#server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) +server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) +#message = bytes.fromhex("011101") +#server.sendto(message, ("192.168.100.255", 51966)) + +message = bytes.fromhex("011100") +server.sendto(message, ("192.168.100.108", 51966)) +#server.sendto(message, ("192.168.100.119", 51966)) +server.sendto(message, ("192.168.100.106", 51966)) + + + +#sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +#sock.bind(("0.0.0.0", 52068)) +#data, addr = sock.recvfrom(4096) +#print ("received message from %s of %i bytes " % (addr, len(data))) |