Strange telnet client behavior when not specifying a port
telnet
is not netcat
. The telnet
protocol is more than raw TCP. Among other things it can have a number of options, and the "noise" you're seeing is the negotiation of these options between your client and the server. When you specify a port you don't see any noise because according to the manual:
When connecting to a non-standard port,
telnet
omits any automatic initiation of TELNET options. When the port number is preceded by a minus sign, the initial option negotiation is done.
So apparently your implementation of telnet
disables option negotiation when you specify a port (even when the port is 23), and re-enables it when the port is preceded by a minus sign.
On a more general note, it's generally safe to forget about telnet
these days. Use netcat
instead if you need a simple plain TCP client (or server, for that matter).
It is highly probable that your telnet
command initiates a TELNET session if you don't specify any port, and initiates a raw TCP connection if any port specified.
telnet
was originally designed to let distant users log into a system. So the protocol (see RFC 854 - first version of it) is designed such that telnet
client negotiates different things with the server just after the connection has been initiated.