I often see that folks test ports this way:

telnet ip-address 80
telnet ip-address 25

AFAIK telnet was the old way of getting onto some remote box - right? or so I thought...

Why exactly can you connect via telnet to smtp port for example?

5 Answers 5


It's for convenience, but it's also a lower-than-user-level diagnostic. You can isolate the problem you're having with a service that way, for example: Joe has a database server and client. They are not communicating. Is the problem on the network? The server? The client?

Joe goes to the client machine and opens a shell. He uses telnet, just as you described:

telnet server.ip.com 3333

and types a command as if he were the client program


The server replies with


(It's a very dumb server)

So then Joe knows that the network link to the server works, and that his client is likely not configured correctly.


Telnet is a very simple protocol, where everything that you type in your client (with few exceptions) go to the wire, and everything that comes from the wire is shown in your terminal. The exception is the 0xFF byte, that setups some special communication states. As long as your communication doesn't contain this byte, you can use telnet as sort of a raw communication client over any TCP port.

IOW: It is purely for convenience.

  • 1
    You cannot use telnet over "any TCP port." You can use it over any TCP connectin where the other side accepts text in its protocol handling. (However it is true that many traditional protocols are text based and thus allow the use of telnet for debugging and similar purposes).
    – Jim Dennis
    Commented Jan 20, 2011 at 3:26
  • 1
    Telnet also translates your local newlines into CRLF pairs, which happen to be required by most of the classical Internet line-based protocols.
    – Alan Curry
    Commented Aug 18, 2012 at 21:43

Why exactly can you connect via telnet to smtp port for example?

Because both smtp and telnet protocols are implemented as plain-text. So with a telnet client, you can basically go connect to any port with a specific protocol that implements plain-text and you know how to communicate using the protocol.

  • thanks. is that what's called ASCII protocol?
    – Stann
    Commented Jan 19, 2011 at 16:18
  • can be called so but mostly prefered as 'plain-text protocols'. ASCII is more of a character-encoding definition while plain-text means text that's unencrypted and that can be followed by naked eye. Commented Jan 19, 2011 at 17:05

Telnet was designed as a remote terminal application utilizing a socket, plain text and a few control characters. Its use in this way has been mostly replaced by ssh. Any telnet client can be used to interface with any protocol that is implemented in plain text and that's how it's most commonly used today.

Although telnet wasn't designed for this purpose it works perfectly using it this way. Netcat actually was designed for this exact use (opening a socket and spitting raw data over it for any purpose). I generally prefer netcat, but telnet is pretty much universally available.


Why not use netcat nc instead of telnet?

We use netcat in our testtool dda-serverspec - precise command

nc [host] [port] -z -w [timeout]

(see https://github.com/DomainDrivenArchitecture/dda-serverspec-crate/blob/61f44990b07779328ffca0ce7081a7eb1ef9d46b/main/src/dda/pallet/dda_serverspec_crate/infra/fact/netcat.clj#L59)

  • That is not an answer to the question asked.
    – JdeBP
    Commented Feb 10, 2019 at 10:41
  • Hinting a more usual tool compared to telnet is not a valid answer?? Long time ago I was happy about exactly this hint!
    – jerger
    Commented Feb 11, 2019 at 11:10
  • No, it is not valid. "We use netcat." is not a valid answer to "Why can telnet be used like this?"
    – JdeBP
    Commented Feb 13, 2019 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .