Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 1996 17:34:49 -0700 (MST)
From:      Ade Barkah <mbarkah@hemi.com>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: bug in 2.2-alpha loopback (?)
Message-ID:  <199612080034.RAA27465@hemi.com>
In-Reply-To: <199612071213.NAA18370@uriah.heep.sax.de> from "J Wunsch" at Dec 7, 96 01:13:18 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 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 - <http://www.hemi.com/>;
-------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612080034.RAA27465>