Help checking a TCP/IP socket connection

Help checking a TCP/IP socket connection

Post by Bob » Wed, 02 Jul 2003 00:39:01


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

Can anyone help understand the behaviour of recv() or suggest a better way
of checking the connection.

Many thanks


1. Checking bandwidth on a tcp/ip socket.

Does anyone know a program which will log the
lowest and the highest throughput on a socket or
a host connection on a 24hour basis?

I am having a problem on a VPN and I need to know when the
throughput on the connection goes down too low.



2. New passwd/yppasswd Program

3. Q: Measuring TCP/IP Socket Connection Timing

4. XS3 server for GENIE users

5. x.25 socket and tcp/ip socket

6. Booting a diskless SLC w Sol2.3 from a Sun3/80 w 4.1.1_U1?

7. How to find the version of awk?

8. Sparc 5/Solaris 2.4 TCP/IP Problem with SL/IP connections

9. tcp/ip LAN IPs and dynamic IP ppp connections....

10. UNIX & TCP/IP & sockets etc - help!!!

11. Unix like Sockets TCP/IP library needed on!!