M
mmaenz
Hi,
My problem is that ServerSocket.accept doesn't catch every connection
made to the socket.
I wrote a little server that gets a connection and spawns a new thread
giving the ServerSocket as parameter to the constructor. Then the
Thread is start()'ed.
The Code is:
ServerSocket serversock = new ServerSocket(port);
while (true) {
Socket socket = serversock.accept();
HandleSocket hs = new HandleSocket(socket);
hs.start();
}
But this code does not catch every connection that will be made to it
and I get a timeout with
the client application. If I retry connection it often works, but the
problem happens randomly.
I can't find anything, that could cause this problem. I'm really a bit
disappointed. I wrote the same application with C++ and had no
problems. But I need it platform independent, thats why I want to use
Java.
Anyone had this problem before? Can anyone help me?
Thanks in advance
- Michael
My problem is that ServerSocket.accept doesn't catch every connection
made to the socket.
I wrote a little server that gets a connection and spawns a new thread
giving the ServerSocket as parameter to the constructor. Then the
Thread is start()'ed.
The Code is:
ServerSocket serversock = new ServerSocket(port);
while (true) {
Socket socket = serversock.accept();
HandleSocket hs = new HandleSocket(socket);
hs.start();
}
But this code does not catch every connection that will be made to it
and I get a timeout with
the client application. If I retry connection it often works, but the
problem happens randomly.
I can't find anything, that could cause this problem. I'm really a bit
disappointed. I wrote the same application with C++ and had no
problems. But I need it platform independent, thats why I want to use
Java.
Anyone had this problem before? Can anyone help me?
Thanks in advance
- Michael