From owner-freebsd-hackers Mon Jan 8 18: 0:39 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from c21bowman.com (unknown [216.140.51.98]) by hub.freebsd.org (Postfix) with SMTP id 29E3837B404 for ; Mon, 8 Jan 2001 18:00:18 -0800 (PST) Received: (qmail 5617 invoked by uid 0); 9 Jan 2001 02:00:07 -0000 Received: from unknown (HELO mike) (10.10.10.200) by 10.10.10.203 with SMTP; 9 Jan 2001 02:00:07 -0000 From: Michael Owens Reply-To: owensmk@earthlink.net Date: Mon, 8 Jan 2001 20:02:53 -0600 X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; charset="iso-8859-1" To: hackers@freebsd.org Subject: FIN_WAIT_2 / TIME_WAIT Confusion MIME-Version: 1.0 Message-Id: <01010820025300.00397@mike> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG If this is not proper place to ask this, let me know and I'll go elsewhere as it is a TCP question. . . but I specifically use (and prefer) FreeBSD. I wrote a simple little I/O multiplexing thing that can act as a client or server as a personal project in network programming. Everything seems fine, except that when I use the client to make multiple connections to a web server. Even though I don't primarly use it for this, the following behvior has me curious. I will run my client about 2 or three times, each time it makes 5 connections, pulling back the main page. Then the weird behavior starts: 1. I will get all data back from all connections except for one, perhaps two, which then sit in a FIN_WAIT_2 or sometimes TIME_WAIT state. 2. When I run netstat -a, it indicates that there is data in the read queue for these clients, but select() always returns 0 ready file descriptors. That's what puzzles me. There is data there to be gotten, but I am not getting it. When I look at the data that comes back in tcpflow, it doesn't look like the whole document has made it back either. A couple of runs might work perfectly, then once or twice will be weird. And it seems to multiplex more connections more reliably than fewer (the weird behavior seems inversely proportional to the number connections---to a point of course. The client runs reliably more times with 50 connections than with 5). Three notes: 1. It seems to happen more if I access machines on my LAN than over the Internet. 2. I do make sure and shutdown the write side of the socket after I send the HTTP request so as to avoid keeping the web server in FIN_WAIT_2. 3. I am sure about having the maxfd + 1 in select() correct, so that's not the problem. Does anyone have any ideas as to what's going on? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message