On 04/22/2013 02:23 PM, Xiangrong Fang wrote:

How do I tell if a socket is still connected or not?

The "connected" State of a TCP/IP socket is a rather complex issue.

A TCP IP connection is either on or off. if it gets disconnected it is dead and can't be reactivated but by a new open.

As long as no event happens to one of the sites, the socket is esteemed connected by this site. This does not mean that the other site thinks the same

Possible events after a successful "open" communication events are
 - data read (-> stays open)
 - write acknowledge (-> stays open)
 - write timeout (socked is forced close)
 - close request from the other site (-> socket close)
 - close request by user (-> socket close)

If there is just no communication, the socket stays open forever.

-Michael
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to