That's a bug in your code. You're giving an uninitialized pointer and
an uninitialized length to accept.  

Try this:

On Sep 23 15:31, Mailing List wrote:

#include <errno.h>

[...]

#ifdef THAT_WOULD_BE_BETTER
        clilen = sizeof (struct sockaddr_in);
        cliaddr = alloca (clilen);
#endif

>       /* Infinite loop waiting for connections */
>       for(;;)
>       {
>               connfd = accept(listenfd, (struct sockaddr *) cliaddr, &clilen);

                if (connfd < 0)
                  printf ("Errno: %d <%s>\n", errno, strerror(errno));
>               
>                       
>               /* Here would be a pthread_create to handle the incomming connection */
> 
>       }
> 
>       return 0;
> }


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:[EMAIL PROTECTED]
Red Hat, Inc.

--
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