开发者

Sending UDP packets via Java

I'm trying to se开发者_StackOverflow社区nd 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.


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.


Maybe it works if use the public DatagramSocket(int port, InetAddress laddr) constructor to create your DatagramSocket and pass it the InetAddress of your local ethernet interface.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜