Message-Id: <200201091733.g09HXMu02464@delorie.com> 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 Delivered-To: mailing list cygwin AT cygwin DOT com Content-Type: text/plain; charset="iso-8859-1" From: Stefan Frings To: cygwin AT cygwin DOT com Subject: Maybe a bug with sockets Date: Wed, 9 Jan 2002 18:32:12 +0100 X-Mailer: KMail [version 1.3.1] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, Please send your answer to ms DOT frings AT mail DOT isis DOT de because I do not read the mailing list very often. Thanks. I think I found a bug in cygwin. I open a socket connection and start a child process after that. Then I cannot close the socket. The following is a reduced source code with that problem. It works fine on Linux but not on CygWin. Compile and run it. The use "telnet localhost 80" to test it. You should see the message "Hello" and then a disconnect message. But the disconnect message is missed until you kill the child process. #include #include #include #include #include #include #include #include #include #define PORT 80                         // Port for TCP/IP Sockets int main(int argc,char** argv) {   struct sockaddr_in address;   int sock;   sock=socket(PF_INET,SOCK_STREAM,0);   setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,0,0);   address.sin_family=AF_INET;   address.sin_port=htons(PORT);   memset(&address.sin_addr,0,sizeof(address.sin_addr));   bind(sock,(struct sockaddr *) &address,sizeof(address));   listen(sock,5);   {     size_t addrlength;     int verbindung;     addrlength=sizeof(address);     verbindung=accept(sock,(struct sockaddr *) &address,&addrlength);     if (verbindung>=0)     {       printf("Verbindung aufgebaut\n");       write(verbindung,"Hello\n",6);       if (fork()==0)               {                 // Child                 close(verbindung);                 while (1)                 {                   printf("Child is running\n");                   sleep(3);                 }                 exit(0);               }       else       {         // Mother         close(verbindung);       }     }   }   return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/