Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I often see that folks test ports this way:

//shell
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?

share|improve this question
add comment

4 Answers

up vote 7 down vote accepted

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.

share|improve this answer
    
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 Jan 20 '11 at 3:26
    
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 Aug 18 '12 at 21:43
add comment

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

WHO;

The server replies with

'11','JOE.CORP.COM'

(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.

share|improve this answer
add comment

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.

share|improve this answer
    
thanks. is that what's called ASCII protocol? –  Stann Jan 19 '11 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. –  HuseyinUslu Jan 19 '11 at 17:05
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.