I'm having trouble receiving a UDP packet sent from an FPGA in a python program. I've checked similar questions and did the following:
- Checked that Wireshark can the see UDP packet
- Disabled windows firewall in PC
- Used sock.bind() since it's UDP packets
- Manually set the destination MAC address on Ethernet frame since FPGA does not support ARP
- Set dest IP to broadcast 10.10.255.255 for testing, no packets received
- Set the UDP checksum of the packet from the sender to 0x0000
Here's the python receiver code:
import socket
import sys
UDP_IP = "10.10.10.87"
UDP_PORT = 4660
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
print("Socket: "+str(sock.getsockname()))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print(data)
print(addr)
sys.stdout.flush()
When tested against another python script that sends to 10.10.10.87:4660 (from another PC in the 10.10.10 network) the receiver script works fine. I've even tried to recreate the UDP pcket byte-by-byte in the FPGA from packets that I know are received OK (Differences are source IP, port & MAC, checksums (disabled), identification).
Here's the output for both packets from Wireshark:
Wireshark UDP packet (Python UDP packet that gets received OK on the left, Xilinx FPGA packet that is not received by python on the right)
I'm not sure what else to try. Any help would be appreciated.
UDP_IP
to your local address is being overly specific. Instead, doUDP_IP = ''
to bind to all interfaces. This won't solve today's problem, but might prevent problems in the future. – Robᵩ