yasin1913 / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 reported on code.google.com by malshant...@gmail.com on 3 Oct 2013 at 1:00

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

Original comment by malshant...@gmail.com on 3 Oct 2013 at 1:01

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

Original comment by malshant...@gmail.com on 12 Oct 2013 at 7:42

GoogleCodeExporter commented 8 years ago
Ah, thanks for reporting back.

Original comment by nathan.s...@gmail.com on 12 Oct 2013 at 8:42