CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    [RESOLVED] Socket State (connected or not)

    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

  2. #2
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    47

    Re: Socket State (connected or not)

    Quote Originally Posted by Cpp_Noob View Post
    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
    Xander Tan

  3. #3
    Join Date
    May 2007
    Posts
    437

    Re: Socket State (connected or not)

    As explained by xander_tan, create some communication protocol to test your client server protocol.

    thia is the only way....
    ashu
    always use code tag

  4. #4
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Socket State (connected or not)

    thanks for the help

  5. #5
    Join Date
    Dec 2007
    Posts
    33

    Re: [RESOLVED] Socket State (connected or not)

    recv() function returns 0 when the connection was closed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured