Problem with socketpair , AF_UNIX and select call - can anybody through any light on this!

Howard Wilkinson howard at cohtech.com
Fri Oct 12 10:25:34 UTC 2007


Luciano Rocha wrote:
> ......
> Is there a reason for using SOCK_DGRAM instead of the usual SOCK_STREAM?
> The latter will make the recv return 0, indicating the other end closed
> the connection, as it did happen, as one peers exits before the other
> select(2)s:
>
> $ ./socketpair 
> server - Socket is ready to write
> server - Socket is not ready to read
> exited: 14520
> master - Socket is ready to write
> master - Socket is ready to read
> master - recv - Resource temporarily unavailable(11)
>
> This could be a bug, or standard behaviour for disconnected datagram
> sockets (I don't know enough of the standards).
>
>   
I attach a slightly improved version. This sleeps for an hour on both 
sides. I have tried removing the MSG_DONTWAIT but still get the same 
response.

The SOCK_DGRAM is because I have small packets flowing that I do not 
want fragmented but do not mind if they get lost, .... but then inside a 
machine that does not matter. However with SOCK_STREAM I get zero length 
messages but still ready to read continuously!!! See attached!

-- 

Howard Wilkinson

	

Phone:

	

+44(20)76907075

Coherent Technology Limited

	

Fax:

	

 

23 Northampton Square,

	

Mobile:

	

+44(7980)639379

United Kingdom, EC1V 0HL

	

Email:

	

howard at cohtech.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071012/9310e560/attachment-0001.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: socketpair.c
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071012/9310e560/attachment-0001.c>


More information about the fedora-list mailing list