How do you send and receive UDP packets in Java on a multihomed machine?

I have a machine with VmWare installed, which has added two additional network interfaces. OS - Vista. I have two Java applications, one of which broadcasts datagrams, and one that receives these datagrams. The problem I am facing is that if I disable both VmWare network interfaces, the receiver will not be able to receive datagrams.

What is the best way to make this work without disabling interfaces?

+4
source share
1 answer

Take a look at the alternative constructor for DatagramSocket:

DatagramSocket(int port, InetAddress laddr) Creates a datagram socket, bound to the specified local address. 

I assume that you specified only the port.

+7
source

Source: https://habr.com/ru/post/1276589/


All Articles