mTCP Netcat logo

Netcat (nc) is a utility that can send and receive data using a TCP/IP socket. It has the ability to open a connection to another machine or to listen for incoming connections. Input can be entered interactively through the keyboard or redirected in from a file. Output can appear on the screen or redirected to a file. Netcat can be used to send large files or short messages, and it can be called from within batch files too.

This version of Netcat is designed for early IBM PCs and similar machines. The features and coding style were chosen to make it very usable even on the oldest and smallest of machines. Features include:


Why use Netcat?

Netcat is like a Swiss Army knife - you can use it to build all sorts of internet enabled utilities without doing TCP/IP programming. If you can put your data in files you can use the redirection built into MS-DOS to have netcat send and receive data for you.

For example, if you want to print from your DOS machine to a network printer you can use netcat to send a file straight to the printer using its "raw" port (9100):

nc -target 9100 -bin < prntfile.bin

Substitute the correct IP address for your network enabled printer, and if your printer supports the printer language used (PDF, PCL, Epson Esc) in the file then it should print it.  (Hint: test with a small file first and be ready to hit the cancel button in the printer just in case.)

How about sending email? Here is a simple text file that contains the commands for an SMTP server to send email:

From: You <>
To: Friend <>
Subject: Test message using Netcat

DOS rules!
Networking with DOS rules even more!


Put that in a text file, correct the names and machines, and then use netcat to send the commands and mail to your outgoing SMTP server:

nc -target 25 -telnet_nl -w 10 < mailtest.txt

That will tell netcat to connect to your ISP's SMTP server on port 25 and send the file to it. (The file is redirected from stdin.) You can pipe the text sent back from the SMTP server to a file to have a record of the email being sent.  (This isn't perfect as it ignores the SMTP return codes, but for a quick and dirty utility it works fine.)

Another possible use is as a low-budget file transfer program between two machines when FTP is not available. For example, this command will setup one machine to listen for an incoming connection and when the connection is received it will write everything that it gets to newfile.bin:

nc -listen 2000 -bin > newfile.bin

On another machine you can use netcat to connect to the waiting machine and send a file:

nc -target 2000 -bin -verbose < origfile.bin

Assuming the the listening machine is at that address, origfile.bin will be read on stdin, transferred over the network, and the listening machine will write it to newfile.bin. It will be an exact copy of origfile.bin.

These are just three of the uses of netcat ...


Netcat is included with the other mTCP based applications. They can be downloaded from the main mTCP page here.

Created July 31st, 2008, Last updated July 5th, 2015
(C)opyright Michael B. Brutman, mbbrutman at