What I do is sending a 'closeSocket' command to the server. After all, usually it's the server that opens the listening socket, so why not letting it to close?
Here's my notices: if we close the socket this way, whenever we try reconnecting, we can get back the free socket. If we didn't close this socket, the service gives us a new socket. This makes me suppose that indeed freeing the socket at the server side, leads to a real close.
Anyway, earlier I used to close the socket at the client's side. This was leading to a aStreams_terminated at the server's side, thus, we could easily close the socket there. Later I've noticed (still don't know whether it's some sort of bug, or it was a fault in my code) that not every time we got the stream termination event. This cycled me back to my first notice.
Another approach, one suggested by Erel, is to get to use a heartbeat mechanism. This is cool, but mostly it has to do with ability or lack of communication, at least so I see it.
To me, freeing up the socket at the server side, tends to work without problems, but certainly if I notice any misbehavior I will give a feedback immediately.