When I use
serverSocket = serverChannel.socket();
serverSocket.bind(new InetSocketAddress(InetAddress.getLocalHost(), 0));
for tcp-based sockets, I get given the address 192.168.0.2, but when I use udp:
serverSocket = new DatagramSocket(new InetSocketAddress(InetAddress.getLocalHost(), 0));
I always get a null or 0.0.0.0 address binding. What is going on here exactly? I want the socket to be bound to 192.168.0.2 so that my other servers can communicate with it.