Subject: Re: Batch Telnet (Re: diskless and 3Com 509)
To: None <>
From: Charles M. Hannum <>
List: tech-net
Date: 03/17/1995 12:58:49
   The message returned is "Connection closed by remote host.", not
   "Connection closed."

And you actually believed that message?  It's wrong.

    if (setjmp(peerdied) == 0)
    (void) NetClose(net);
    ExitString("Connection closed by foreign host.\n",1);

The code is structured rather poorly.  It ought to generate that
message where it actually notices that the socket is closed.

   The problem is clearly that the client is getting a close before it
   reads the data to be displayed.

Not at all.  If you actually look at the packets on the wire, you'll

1) The client sends a FIN.

2) The server sends some data.

3) The client responds to the data with a RST.

tcpdump(8) leaves no doubt that the problem, if any, is in the client.

Actually, I misspoke about TCP.  The client can close the write side
by sending a FIN.  However, the telnet client is currently closing
both sides of the connection when it gets an EOF on stdin.  This is
really easy to fix.  In fact, I just did it.