Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 23 Sep 2004 11:20:19 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Blocking accept() broken? Message-ID: <20040923092019.GC12802@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <2da66eca04092222055f9bdc75 AT mail DOT gmail DOT com> <20040923051622 DOT GH9804 AT trixie DOT casa DOT cgf DOT cx> <2da66eca04092222313d8a662b AT mail DOT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2da66eca04092222313d8a662b@mail.gmail.com> User-Agent: Mutt/1.4.2i 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 [...] #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 AT cygwin DOT 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/