* Help checking a TCP/IP socket connection
@ 2003-06-30 15:39 Bob
0 siblings, 0 replies; only message in thread
From: Bob @ 2003-06-30 15:39 UTC (permalink / raw)
Hi,
We have an in-house communication system running on Tru64 unix. It employs
non-blocking TCP/IP sockets for IPC within a single host. We wish to test
the connection between a pair of processes prior to attempting to send a
message - a method called "isConnected()".
Our current implementation of isConnected() follows these steps:
1. Attempt a recv() from the target with the MSG_PEEK flag set.
2. If recv() returns a value >0 we return true.
3. If recv() returns -1 and errno is set to EWOULDBLOCK we return true.
4. Otherwise we return false.
We are frequently finding that both errno and the return value from recv()
are 0. This suggests that the connection to the target has been lost.
However, this would seem to incorrect as subsequent messages are sent
correctly.
Can anyone help understand the behaviour of recv() or suggest a better way
of checking the connection.
Many thanks
Jeff
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-06-30 15:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-30 15:39 Help checking a TCP/IP socket connection Bob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox