Thread: Socket Client Detect Disconnected Equip.

  1. #1
    Registered User
    Join Date
    Nov 2008

    Socket Client Detect Disconnected Equip.

    I have a Socket Client and need detect when my socket server (an Equipment) was disconnected.

    But I don't wanna send characters to discovery this.

    What I Would to use ? KeepAlive ? SendTimeout SocketOptionLevel ?
    And how to make it....

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    RING 0
    I believe receicve will return 0 for a graceful disconnect, and < 0 for un normal disconnects. Either that or the socket will throw an exception when you try reading from something not connected.

  3. #3
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    If you're using TCP, then Valaris is correct, remember the the recieve call is a loop that will keep reading whilst the condition you set it still exists or for the reasons Valaris said.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. Socket Programming Problem!!!!
    By bobthebullet990 in forum Networking/Device Communication
    Replies: 2
    Last Post: 02-21-2008, 07:36 PM
  3. socket web client
    By Abila in forum C Programming
    Replies: 0
    Last Post: 06-28-2003, 04:42 PM
  4. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM
  5. Replies: 4
    Last Post: 05-28-2002, 06:19 PM