Search code examples
javaudpethernetfpgadatagram

Sending UDP packets via Java


I'm trying to send UDP packets from my PC to an FPGA via my laptop's ethernet cable. I've been using Java's DatagramPacket and DatagramSocket to send the UDP packets. However, these packets will only send over my laptop's wireless interface. How can I specify that the packets should go through my ethernet interface?

Thank you.


Solution

  • You may of course bind your DatagramSocket to a specific interface as x4u suggested, but if your UDP packets are sent on an incorrect interface, I would rather assume that the routing table of your operating system's network stack is configured incorrectly, so that the operating system believes your FPGA to be reachable through the WLAN interface instead of your ethernet interface.