Interesting! C client socket communicating with java server sockets after..

Hi,

I have a client(in C) open a socket and server(in java; jvm 1.2) listening on the same port(e.g. 4444) accepts the request and establishes a socket conn. Now the sockets are kept open indefinitely. If I kill the server process and bring it backup, the client(in C) cannot communicate with the server(in java).

Why would this be happening? Aren't the server socket garbage collected?

How do I make sure that the next time I bring up the server again, the client communicates with it.

Any inputs is really appreciated.

thanks

atul.

[591 byte] By [atoolm] at [2007-9-26 2:03:37]
# 1
Presumably your C client re-establishes the connection when the java server goes down - right?
jschell at 2007-6-29 8:46:34 > top of Java-index,Core,Core APIs...
# 2

Check the client is closing the connection before it stops.

I've had similar problems with JDBC before where if you don't explicitly close the connection it remains bound to the port, hence if your client only ever tries to connect to that port it will fail.

I think.

MrChris

BluSeiger at 2007-6-29 8:46:34 > top of Java-index,Core,Core APIs...
# 3
Once the connection is broken, it must be reestablished on both ends. you can just sit there and expect the socket you opened earlier, which was broken, to magically reconnect to the port again can you?
dnoyeB at 2007-6-29 8:46:34 > top of Java-index,Core,Core APIs...