not-yet-connected sockets?

Dan Kegel dank at kegel.com
Thu Aug 16 23:23:05 CDT 2001


Daniel Walker wrote:
> 
> Dan Kegel wrote:
> >
> > Daniel Walker wrote:
> > >
> > >         The problem is that poll returns POLLHUP when a socket isn't connected,
> > > then wine ignores the socket and it's events .. I realize this has been
> > > known for a some time(since linux 2.4), but why hasn't it been fix?
> > > Doesn't this effect a lot of non-blocking socket applications?
> >
> > Can you define the problem a bit more?  Do you mean you get a POLLHUP
> > *while waiting* for connection?
> 
>         No, I mean that a socket is created using socket() then, say, ioctl()
> is run on it. ioctl() then ,through the wineserver, runs sock_reselect()
> then poll() returns POLLHUP in revents and the wineserver stop watching
> the socket .. Since most non-blocking applications run socket() then
> ioctl() I would think that several applications would be effected..

When I run the following program, I get n=0 consistently on linux 2.2 or 2.4.
Did I misunderstand the test condition?

#include <stdio.h>
#include <sys/poll.h>
 
main()
{
        int fd;
        struct pollfd pfds[1];
        int n;
 
        fd = socket();
        pfds[0].fd = fd;
        pfds[0].events = POLLIN|POLLOUT;
        n = poll(pfds, 1, 0);
        printf("n %d, revents %x\n", n, pfds[0].revents);
}    


-- 
"I have seen the future, and it licks itself clean." -- Bucky Katt




More information about the wine-devel mailing list