Subject: Re: Dumb/silly network programming question
To: Paul Goyette <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 12/10/2003 15:29:28
Content-Type: text/plain; charset=us-ascii
On Tue, Dec 09, 2003 at 07:14:20PM -0800, Paul Goyette wrote:
> Remember, the socket is set to O_NONBLOCK since I don't want writes
> to stall and I'm too lazy to keep toggling O_NONBLOCK on for write,
> off for read. :)
My code also is using O_NONBLOCK for reads.
> When the client is SIGKILLed, the server's select(2) returns with the
> socket's fd's bit set in the readmask. Each read, first or more,
> returns with retval=3D-1 bytes read and errno=3DEAGAIN (=3D35). At no ti=
> does the server's recv(2) return zero - always -1.
You said "read" earlier. read(2) and recv(2) have different EOF semantics.
recv(2) does exactly what you are seeing. Its interface doesn't seem to be=
able to indicate EOF.
Since you're using a TCP socket, I'd suggest using read(), not recv().
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----