D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Testing an open socket



On Wed, Jul 10, 2002 at 03:18:21PM +0100, John Horne wrote:

A quick question: does anyone know how I can test from within a c program
whether a given socket is still open or not, without sending anything down
it? Our big brother monitoring system opens a socket to a system using (say)
port 23 for telnet. The system has inetd configured for telnet but has tcp
wrappers around it and disallows any telnet access. In that respect the
socket gets closed by the remote system, but big brother doesn't see this.
Hence it reports that telnet is available on that system, when in fact it
isn't.

If you select() on the socket and it's not available for write, then
it's dead dude.

There may be some SIGPIPE action too :)

Steve

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly