Sockets, sendmsg, buffer space and non-blocking I/O

nose at nbires.UUCP nose at nbires.UUCP
Wed May 7 02:55:57 AEST 1986


   I'm using a datagram socket in the AF_UNIX domain (Running under 4.2bsd).
I'm using it in a client/server application. I notice that if my client
sends too many messages (Faster than they can be processed by the server)
eventually, sendmsg will return with errno 55, ENOBUFS.
   The documentation under "send" says, and I quote, "If no messages space
is available at the socket to hold the message then send normally blocks,
unless the socket has been placed in non-blocking i/o mode." Also the list
of possible errors doesn't even include ENOBUFS.
   My question how do you get a socket to be in non-blocking i/o mode or
more specifically why is my socket in this mode? Note that I did not do
any ioctl calls anywhere in this program.
   On a related topic I notice that if my client is started up without
the server being present, sendmsg will return various interesting errno's.
If the file representing the server's socket is not present, error number 2,
ENOENT will be returned. Presumably this is because the system went looking
for the file and didn't find it, however this error number is not in the list
of possible error numbers for this call. If the file representing the server's
socket is present but the server process itself is not present, sendmsg will
return error number 61, ECONNREFUSED. Again this is not in the list of
returned error codes. I find this one to be especially "interesting" since
I am using a datagram socket which is defined to be connectionless so I can
hardly imagine how there could be any connection attempt to be refused.

                -Steve "They're coming to take me away" Dunn



More information about the Comp.unix.wizards mailing list