Hello,

Just very simple program
and very strange behaviour....

int main()
{
        int fd;
        struct pollfd pds[2];
        struct sockaddr_in sai;

        fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        sai.sin_family      = AF_INET;
        sai.sin_port        = htons(6666);
        sai.sin_addr.s_addr = INADDR_ANY;
        bind(fd, (struct sockaddr *)&sai,sizeof(sai));
        printf("Before poll. Sleep 10 sec.\n");
        sleep(10);
        pds[0].fd     = fd;
        pds[0].events = POLLIN|POLLERR;
        pds[0].revents = 0;
        poll(pds, 1, (int)(5000));
        printf("After poll\n");
        sleep(1000);
}

So, before "poll(pds, 1, (int)(5000));"

netstat -a -n shows
[EMAIL PROTECTED] ~/
$ netstat -a -n -o |grep 2860
  UDP    0.0.0.0:6666           *:*                                    2860


And after poll
[EMAIL PROTECTED] ~/
$ netstat -a -n -o |grep 2860
  UDP    0.0.0.0:6666           *:*                                    2860
  UDP    127.0.0.1:3074         *:*                                    2860


why 'poll' create and bind new socket??
Is this a bug??

tested on
cygwin1.dll v.1.5.21 a some older....

Vadim G Melihow


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to