Subject: socketpair()
To: None <netbsd-users@netbsd.org>
From: Jorgen Lundman <lundman@lundman.net>
List: netbsd-users
Date: 03/06/2003 17:37:19
I have a wee question about socketpair(). I use it to communicate with a 
child, set both ends to non-blocking and sit in select() loops.

The call is:

ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);


For small loads of traffic all is well.

However, for larger amounts (say, ls'ing in /dev) it sometimes drop packets.

I checked that my write(pipe, ...) call always returns the same number 
of bytes as I wanted to write (and it does!).


However, if I replace system socketpair() with my own version (socket, 
bind, listen, socket, connect, accept, nonblocking) it never drops 
packets no matter how traffic is sent. (And indeed, write can return 
less than specified, or, EWOULDBLOCK which I deal with appropriately).


Is this normal behavior that write() would return all is well, but data 
is silently dropped? Similar to UDP, except SOCK_STREAM was specified 
when calling socketpair().


Lundy


-- 
Jorgen Lundman       | <lundman@lundman.net>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)