W3C home > Mailing lists > Public > ietf-discuss@w3.org > February 1999

Re: Use of TELNET for testing protocols

From: Tony Hansen <tony@att.com>
Date: Mon, 15 Feb 1999 10:45:00 -0500
Message-ID: <36C840FC.8F84D8B0@att.com>
To: Jacob Palme <jpalme@dsv.su.se>
CC: discuss@apps.ietf.org
Jacob Palme wrote:
> At 23.27 +0100 99-02-11, Chris Newman wrote:
> > Efficiency brings in all sorts of tradeoffs.  One can make a protocol use
> > a few fewer bytes on the wire by using a binary encoding, but this has the
> > expense of requiring significant additional programmer time to develop
> > debugging and testing suites since "telnet" doesn't work any more.
> I know that you can use TELNET to test a server by
> simulating a client, by a human typing or pasting the client
> parts of a textual protocol.
> But how can you use TELNET to test a client by simulating a
> server? This would certainly be very useful, and perhaps
> this is common knowledge which I have not acquired?

You have to use some glueware. In particular, a program that would do
the trick would monitor two ports and forwards packets between the two.
I've never seen such a program, but it should be possible to write it
very quickly in perl or most other languages.

	Tony Hansen

# pseudo code follows. anyone care to finish it?
$port_telnet = $ARGV[1];	# telnet to this port
$port_client = $ARGV[2];	# may need root to accept connections here

accept connection on ports $port_telnet and $port_client

while (select($port_telnet | $port_client, 0, 0, 0))
    if ($port_telnet has input)
        $buf = sysread($port_telnet);
        ... check for errors, EOF, etc.
        syswrite($port_client, $buf, length $buf);
    if ($port_client has input)
        $buf = sysread($port_client);
        ... check for errors, EOF, etc.
        syswrite($port_telnet, $buf, length $buf);
Received on Monday, 15 February 1999 10:50:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:08:05 UTC