I'm supposed to connect to embedded server through TCP sockets (custom protocol).

Just for sanity check, I've done sample which do following steps:

1. TCP Connect (IPaddress, port);
2. Send Test IP packet (server init command);
3. Receive Responce;
--> 4. TCP Close.

This sequence works without glitch (yet).

Problem:
If client exits just one time without 4th step (TCP Close), then:
1. Next time it goes through steps 1-2 and on 3 never get any responce from server.
2. After that if I restart client, it breaks just on step 1 with "server actively refused connection". And MAINTAINs to refuse connections on that (address,port) for very long time >6hrs . Besides, http connection to same address (from brouser) is ok.


Can anybody shed some light on the situation ? Isn't server supposed to handle that kind of situations ?