Click to See Complete Forum and Search --> : [RESOLVED] Socket State (connected or not)


Cpp_Noob
June 27th, 2009, 10:08 AM
how can i check that current state of a socket? if its connected or not
i have multiple clients on a server and i want to check if client X is still connected or not

xander_tan
June 28th, 2009, 09:02 PM
how can i check that current state of a socket? if its connected or not
i have multiple clients on a server and i want to check if client X is still connected or not

If you use your own protocol for the client-server application, then you can add in a functionality in both client and server side to perform "ping" when the client is idle.

For example: TELNET protocol has Are You There (AYT) command.
http://support.microsoft.com/kb/231866

ashukasama
June 28th, 2009, 09:21 PM
As explained by xander_tan, create some communication protocol to test your client server protocol.

thia is the only way....

Cpp_Noob
June 29th, 2009, 07:19 AM
thanks for the help :)

skval
June 30th, 2009, 03:27 PM
recv() function returns 0 when the connection was closed.