On Fri, Feb 14, 2003 at 10:33:23AM +0000, Henry Richard wrote: > This time I upgrade my cygwin version to 1.3.20 and using gcc 3.2. The > program I submit last time does work in this new environment. How ever, I > have found that fork() can't be executed twice before closing the socket, > otherwise the telnet client will be blocked unless giving it a ^]. > > I think this problem is also caused by Winsock2 in Windows 2000 system, > according to Microsoft KB. > [...]
I did play with sockets a lot to get it working almost as on POSIX systems. Actually I have no way around the described problem so far as long as the application isn't changed. However, the change is simple and useful, just add a shutdown() call prior to the child's close(): > loop=2;/* if loop is greater than 1, socket won't be closed > */ > for (i = 0; i < loop; i++) { > pid = fork(); > if (pid > 0) { > close(accefd); > return 0; > } > } shutdown (accefd, SHUT_RDWR); > close(accefd); > sleep(100000); > } > } This helps. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:[EMAIL PROTECTED] Red Hat, Inc. -- 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/