Help checking a TCP/IP socket connection
From: Bob (noboby_at_nobody.com)
Date: 06/30/03
- Next message: James Murray: "Re: MAJOR ISSUE: vrestore from tape under Tru64 4.0F"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 30 Jun 2003 16:39:01 +0100
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
- Next message: James Murray: "Re: MAJOR ISSUE: vrestore from tape under Tru64 4.0F"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|