jocket icon indicating copy to clipboard operation
jocket copied to clipboard

TestServer.java doesn't work

Open artemik opened this issue 7 years ago • 1 comments

Software caused connection abort: socket write error

Exception in thread "main" java.net.SocketException: Software caused connection abort: socket write error
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:134)
	at java.io.DataOutputStream.writeInt(DataOutputStream.java:199)
	at jocket.net.ServerJocket.accept(ServerJocket.java:76)

artemik avatar Aug 18 '17 13:08 artemik

Sorry, missed the notification. What did you do to get this error? Is it reproducible?

A real socket is used for the handshake between client and server.

Probably your network setup is not compatible with the way the socket is initialized, i.e.

ServerJocket: srv.bind(new InetSocketAddress(InetAddress.getByName(null), port));

JocketSocket: Socket s = new Socket(InetAddress.getByName(null), port);

I admit I don't precisely remember why it is initialized this way... After checking this is supposed to return a loopback address. You can try adding constructors that accept an IP address (such as 127.0.0.1 or 0.0.0.0) and call them from TestClient/Server.

pcdv avatar Aug 23 '17 15:08 pcdv