Re: xinetd client disconnects



On Thu, 30 Jun 2011 02:26:15 +0100, Tarim wrote:

Martin Gregorie wrote:
> You get a zero response from recv() when the client closes the
> socket.

You don't get to see the socket itself with an xinetd server as
xinetd wraps it all up and hands it to the server on stdin and stdout -
which is very handy if you don't want to do anything fancy.

I thought that too, so I double checked my memory with reference to some
code I wrote a while back.

It was written for xinetd and run under it to check what needed to be
done to write a simple, reliable start-on-demand server. It uses
recv(0, &buff, lth) to read messages, so its sucking on fd0 as though its
a socket. This works, as I said, with recv() returning zero when the
client closes the connector. It uses essentially the same trick to send
replies calling send(1, buff, lth) to push stuff down fd1.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
.



Relevant Pages

  • Re: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: bin/131567: Update for regression/sockets/unix_cmsg
    ... -Usually each test does following steps: create Server, fork Client, ... Sometimes Client sends several ... +If Client sends some ancillary data object, ... Receiving sockcred (listening socket has LOCAL_CREDS) ...
    (freebsd-net)
  • Re: bin/131567: Update for regression/sockets/unix_cmsg
    ... -Usually each test does following steps: create Server, fork Client, ... Sometimes Client sends several ... +If Client sends some ancillary data object, ... Receiving sockcred (listening socket has LOCAL_CREDS) ...
    (freebsd-net)
  • Re: bin/131567: Update for regression/sockets/unix_cmsg
    ... -Usually each test does following steps: create Server, fork Client, ... Sometimes Client sends several ... +in the msg_iov field from struct msghdr. ... Receiving sockcred (listening socket has LOCAL_CREDS) ...
    (freebsd-net)
  • Re: Locking on async calls
    ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
    (microsoft.public.dotnet.general)