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:

Here is the detailed readme for netcat: nc.txt

Features

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, here is a simple text file that contains the commands for an SMTP server to send email:

HELO mail.yourdomain.com
MAIL FROM:<you@yourdomain.com>
RCPT TO:<friend@somewhereelse.com>
DATA
From: You <you@yourdomain.com>
To: Friend <friend@somewhereelse.com>
Subject: Test message using Netcat

DOS rules!
Networking with DOS rules even more!

-Bye!
.
QUIT

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 smtp.yourisp.com 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 192.168.2.10 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 two of the uses for netcat ...


Download!


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 29th, 2011
(C)opyright Michael B. Brutman, mbbrutman@gmail.com