STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_udp.py
Go to the documentation of this file.
1import socket
2import sys
3
4target_ip = "127.0.0.1"
5target_port = 5006
6source_ip = "192.168.2.101"
7
8print(f"Testing UDP from {source_ip} to {target_ip}:{target_port}")
9try:
10 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
11 sock.bind((source_ip, 0))
12 print(f"Bound to {source_ip}")
13 sock.sendto(b"test packet", (target_ip, target_port))
14 print("Sent packet")
15except Exception as e:
16 print(f"Error: {e}")
17finally:
18 sock.close()