From owner-freebsd-hackers Fri Jun 20 05:36:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id FAA00152 for hackers-outgoing; Fri, 20 Jun 1997 05:36:17 -0700 (PDT) Received: from pandora.hh.kew.com (root@kendra.ne.highway1.com [24.128.53.73]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id FAA00146 for ; Fri, 20 Jun 1997 05:36:14 -0700 (PDT) Received: (from ahd@localhost) by pandora.hh.kew.com (8.8.5/8.8.5) id HAA02285; Fri, 20 Jun 1997 07:31:51 -0400 (EDT) Date: Fri, 20 Jun 1997 07:31:51 -0400 (EDT) From: Drew Derbyshire Message-Id: <199706201131.HAA02285@pandora.hh.kew.com> To: adrian@deathstar.ml.org, freebsd-hackers@FreeBSD.ORG Subject: Re: socket redirector Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > From: Adrian Chadd > I'm writing a quick socket redirector for something. Its run out of inetd, > and basically opens a socket somewhere and acts as a pipe between the two. > I'm using select(), and its working fine. The only problem I'm having is > that I don't know how to tell when the remote end closes the connection > down, so that I can just close everything down, and quit. > > Any ideas on how I'd do this? Get this from the distribution: socket-1.1 create tcp socket and connect to stdin/out Note that I have loaded it but not tested it. To answer the source question, I think it's wait for the socket to go ready on read, and a zero byte read is EOD, just like a file. -ahd-