EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.82k stars 419 forks source link

Kryonet throws Bind Exception in server.bind() #41

Closed ghost closed 10 years ago

ghost commented 10 years ago

From malshant...@gmail.com on October 03, 2013 15:00:00

The code I used is as follows

try { Server server = new Server(); server.start(); server.bind(16384); server.addListener(new Listener() { public void received (Connection connection, Object object) { byte[] b = (byte[]) object; System.out.println("Received Time: " + System.currentTimeMillis() + " " + b.length); } });

    }
    catch(Exception e)
    {
        throw e;
    }

Kryonet throws Exception in thread "main" java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Unknown Source) at sun.nio.ch.Net.bind(Unknown Source) at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at com.esotericsoftware.kryonet.Server.bind(Server.java:133) at com.esotericsoftware.kryonet.Server.bind(Server.java:117) at KryoMain.deployServer(KryoMain.java:33) at KryoMain.main(KryoMain.java:53)

Original issue: http://code.google.com/p/kryonet/issues/detail?id=40

ghost commented 10 years ago

From malshant...@gmail.com on October 03, 2013 06:01:33

This issues is seen with any port. I made sure this particular port is not used by any other application running in my PC.

ghost commented 10 years ago

From malshant...@gmail.com on October 12, 2013 00:42:43

No issues. I had called the same function in constructor and from the object that caused this issue. Sorry about that.

ghost commented 10 years ago

From nathan.s...@gmail.com on October 12, 2013 01:42:46

Ah, thanks for reporting back.

Status: Invalid