Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Markus Hoenicka" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14897.28668.934000.940116@gargle.gargle.HOWL> Date: Fri, 8 Dec 2000 23:34:20 +0000 (CT0) To: Corinna Vinschen Subject: Re: socket read()/write() problem in 1.1.6 In-Reply-To: <00120813285702.12851@cygbert> References: <1529f1887b DOT 1887b1529f AT uth DOT tmc DOT edu> <00120813285702 DOT 12851 AT cygbert> X-Mailer: VM 6.75 under Emacs 20.6.1 Let me please add another important (I think) bit of information. In my previous mail I reported that a call to fork() is essential to reproduce the weird read()/write() problem. It turns out that only the child is affected. If I modify the server to let the parent answer the client request after forking, everything is fine again. This should IMHO rule out any timing related issues. A small change to server program will do the trick: ------------------------------------------------------ --- server5b.c Fri Dec 8 16:49:27 2000 +++ server5c.c Fri Dec 8 21:55:46 2000 @@ -52,22 +52,22 @@ printf("adding client on fd %d\n", client_sockfd); } else { - if (fork() == 0) { /* child */ + if (fork() != 0) { /* parent */ iread(fd, ch, 10); sleep(1); - printf("child serving client on fd %d; ch=%s<<\n", fd, ch); + printf("parent serving client on fd %d; ch=%s<<\n", fd, ch); ch[0]++; iwrite(fd, ch, 5); iwrite(fd, ch+5, 5); close(fd); FD_CLR(fd, &readfds); - printf("child done on fd %d; ch=%s<<\n", fd, ch); - exit(0); + printf("parent done on fd %d; ch=%s<<\n", fd, ch); } - else { /* parent */ + else { /* child */ close(fd); FD_CLR(fd, &readfds); - printf("parent done on fd %d\n", fd); + printf("child done on fd %d\n", fd); + exit(0); } } } ------------------------------------------------------ So my (un)educated guess is that it is less a read()/write() problem per se but rather a problem how an inherited socket is set up in the child process after forking. regards, Markus -- Markus Hoenicka, PhD UT Houston Medical School Dept. of Integrative Biology and Pharmacology 6431 Fannin MSB4.114 Houston, TX 77030 (713) 500-6313, -7477 (713) 500-7444 (fax) Markus DOT Hoenicka AT uth DOT tmc DOT edu http://ourworld.compuserve.com/homepages/hoenicka_markus/ -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com