Karjala wrote:
I'm writing a simple client-server application, and I'm trying to find a
way to tell if the other end of an open TCP connection has gone offline.
If the other side has closed its end of the connection, you detect this
by reading from the socket and receiving EOF (0 bytes read),
On client side, you can write:
$sock->shutdown(1);
to send an EOF to remote server.
When the server receive the EOF,it will end of writing socket to
client,and send back an EOF to client.At this point,the socket talks
between client and server have finished.
2005/10/31, Karjala <[EMAIL PROTEC
I'm writing a simple client-server application, and I'm trying to find a
way to tell if the other end of an open TCP connection has gone offline.
I heard that with C you can send a packet of data and check if an ACK
packet comes back. If it doesn't then the connection is closed. But how
can th