This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Blocking accept() broken?
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:cygwin@cygwin.com
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/