Skip to main content

Server will accept connections at /0.0.0.0:

3 replies [Last post]
andrew_i
Offline
Joined: 2009-05-06

Hello,
I'm new to JXTA and when i compiled the hello world example, I observed the following line:
Server will accept connections at /0.0.0.0:9071.
My question is how is this possible? Instead of /0.0.0.0 I think it should be my ip. I'd appreciate if you could point me to the right direction. Below I attached my code. The jxta version I used is 2.5 Thank you very much.

NetworkManager my_networkmanager;
NetworkConfigurator my_config;

my_config=new NetworkConfigurator();
try
{
my_networkmanager=new NetworkManager(NetworkManager.ConfigMode.SUPER,"my_peer");
my_config =new NetworkConfigurator();
my_config=my_networkmanager.getConfigurator();
my_networkmanager.startNetwork();

}
catch(PeerGroupException peer_exp)
{
peer_exp.printStackTrace();
}
catch(IOException io_exp)
{
io_exp.printStackTrace();
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bondolo
Offline
Joined: 2003-06-11

This isn't an error.

0.0.0.0 is known as ALL_ANY_ADDRESS. The IPv6 equivalent is ::0

When it is used as the address for server sockets it is interpreted as listen on all network interfaces. When it is used for sending as the target interface it means again all interfaces but, depending on the protocol used might also mean any interface or the "best" interface where the operating system chooses whichever interface is best for the specified destination.

Even if you have only a single interface binding to 0.0.0.0 has the advantage that server sockets will survive a DHCP address reassignment and not be closed when the host IP address changes.

Mike

andrew_i
Offline
Joined: 2009-05-06

Nobody?

desaipremal
Offline
Joined: 2008-07-03

Just set the interface address to your local IP address as below. Save the configuration and then start the network manager

NetworkConfigurator myConfigurator = manager.getConfigurator();
myConfigurator.setHttpInterfaceAddress("192.168.200.14");
myConfigurator.save();
manager.startNetwork();