user3693597
user3693597

Reputation: 1

Error: Cannot assign requested address: JVM_Bind

When I used

 InetAddress addr = InetAddress.getByName("192.168.1.104");
 listen_socket = new ServerSocket(port,5,addr);

then it works fine

But when use dynamic ip

  InetAddress addr = InetAddress.getByName("114.143.95.69");
  listen_socket = new ServerSocket(port,5,addr);

the following error will be thrown

Error: Cannot assign requested address: JVM_Bind

What should I do to resolve the problem?

Upvotes: 0

Views: 2583

Answers (1)

user207421
user207421

Reputation: 311039

Your dynamic IP is the address of your router, not an IP address belonging to an NIC of the localhost.

Use "0.0.0.0", or a null InetAddress, for that parameter.

Upvotes: 2

Related Questions