From owner-freebsd-hackers Sat Dec 7 16:35:09 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id QAA18310 for hackers-outgoing; Sat, 7 Dec 1996 16:35:09 -0800 (PST) Received: from hemi.com (hemi.com [204.132.158.10]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id QAA18304 for ; Sat, 7 Dec 1996 16:35:03 -0800 (PST) Received: (from mbarkah@localhost) by hemi.com (8.8.3/8.7.3) id RAA27465; Sat, 7 Dec 1996 17:34:49 -0700 (MST) From: Ade Barkah Message-Id: <199612080034.RAA27465@hemi.com> Subject: Re: bug in 2.2-alpha loopback (?) To: joerg_wunsch@uriah.heep.sax.de Date: Sat, 7 Dec 1996 17:34:49 -0700 (MST) Cc: freebsd-hackers@freebsd.org In-Reply-To: <199612071213.NAA18370@uriah.heep.sax.de> from "J Wunsch" at Dec 7, 96 01:13:18 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > I can't reproduce this with your test program: > > j@uriah 1455% ./bar > Waiting for client on port 2000 > Attention, read() returned 0. Sorry, I wasn't very careful considering all the variables. This might be a "telnet" problem instead of a loop interface problem (My 2.2 machine is located remotely, so that's why I noticed it.) I have been telnetting into the 2.2 machine, "telnet localhost 2000", then close the first telnet. The problem occurs when I telnet into a FreeBSD machine, _then_ telnet again to port 2000, issue the escape character, and close the connection. So, we have: Machine A ---telnet---> Machine B ---telnet---> Machine C Where the program is running on Machine C, and Machine B is a FreeBSD 2.1 or 2.2 system. Machine B's telnet gets really confused when we close Machine A's telnet. Please try: 1. Run the program 2. From another window / virtual terminal, "telnet localhost", log back in, then "telnet localhost 2000", issue ctrl-], and quit (or close). I changed my program to count how many \004s it receives, and on my machines I get: ./read Waiting for client on port 2000 read() returned 0, exiting. Received 278 EOF (CTRL-D) markers. (The exact number of CTRL-Ds it receives varies.) For clarity, the program does the following: nCtrl = 0; for (c = 0; c < 1000 ; c++) { ret=read (fd, &ch, 1); if (ret == 0) { printf ("read() returned 0, exiting.\n"); break; } if (ch == 4) ++nCtrl; } printf ("Received %d EOF (CTRL-D) markers.\n", nCtrl); (It doesn't make a difference if recv() is used instead of read().) The problem does not occur if I replace the middle machine with a non-FreeBSD machine (well, I've only tried Solaris 2.5.1, VMS V5.5-2, and various Cisco boxes.) It doesn't matter what O/S machine A or machine C is running. Hmm, are programs supposed to check for an EOF in the input stream ? Thanks, -Ade ------------------------------------------------------------------- Inet: mbarkah@hemi.com - HEMISPHERE ONLINE - -------------------------------------------------------------------