0

I can use both nc and telnet to connect to port 25.

$ nc 192.168.1.120 25
220 localhost ESMTP Exim 4.68 Tue, 29 Dec 2020 06:07:27 +0000

$ telnet 192.168.1.120 25 Trying 192.168.1.120... Connected to 192.168.1.120. Escape character is '^]'. 220 localhost ESMTP Exim 4.68 Tue, 29 Dec 2020 06:07:32 +0000

I am trying to understand the difference between nc and telnet. Although there is some discussion here, it does not explain in light of the above example.

what is the difference between telnet and netcat?

Could anybody explain the difference between nc and telnet using the above example?

Can both of them be used to get the same results for this example? Thanks.

1 Answers1

1

In the SMTP example you gave they do pretty much the same thing.

Telnet is designed to be used by people (think terminal emulator). It works only with tcp and does not candle ASCII characters which can't be typed on a keyboard very well. It was one of the first programs available on the Internet and was used to connect to remote machines in the days before security was a thing.

nc - netcat - is much newer and is designed to work with programs/pipes with binary output (and also UDP protocol I believe). If in doubt, nc us a better tool to use, but telnet is/was more ubiquitous.

davidgo
  • 73,366