Обсуждение: socket programming - accept blocking

Поиск
Список
Период
Сортировка

socket programming - accept blocking

От
Ryan
Дата:
I am in the process of learning about socket programming.  I am creating a
simple web server that accepts a connection and provides the requested file.  I
have tested my code on a true linux machine and it works fine.  I am having
problems getting it to work properly in Cygwin.

The faulty segmet of code is:

    if ((s_curr = accept(s, (struct sockaddr *) &pin, &addrlen)) == -1)
    {
        printf("ERROR: accept\n");
    }

    printf("Connection Received\n");

The accept command does not block, so everytime I try to start up the server, I
immediately get the ERROR message.

Like I said, this code works perfectly on a true linux machine, so I was
wondering why it is not working in Cygwin.  Does anybody have any suggestions?

Thanks,

Ryan