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

Luciano Rocha strange at nsk.no-ip.org
Fri Oct 12 10:32:09 UTC 2007


On Fri, Oct 12, 2007 at 11:29:26AM +0100, Andy Green wrote:
> Somebody in the thread at some point said:
> 
> > 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!
> 
> Why don't you try removing the O_NONBLOCK since you test with select...
> 
>   fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL, 0) | O_NONBLOCK);
>   fcntl(fd[1], F_SETFL, fcntl(fd[1], F_GETFL, 0) | O_NONBLOCK);

In some instances it is possible to select to return OK and an operation
then blocks. So it is always best to use select/poll, have the fds set
non-block, and check for EINTR/EAGAIN.

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071012/87494d3b/attachment-0001.sig>


More information about the fedora-list mailing list