.comment-link {margin-left:.6em;}

Thursday, August 26, 2004


How to Chat Via Netcat

This geeky nugget showed up in a newsgroup I frequent. Credit goes to pchelp.

I'm not sure how useful it would be, given the prevalence of things like IM, SSH, and telnet, but printing to a remote user's terminal and allowing them to print back strikes a minimalist bone somewhere in my body.

I'm sure this is possible on *nix (nc originated there), but the poster has limited his instructions to windows. I think this will work on any platform if you substitute all mentions of DOS with console or terminal and give it a try.

-for Windows platforms

Requires Netcat (NC.EXE).

Parties at both ends must know one another's IP address.

Open two (2) command (DOS Prompt) windows. Place one above the other on
your desktop.

Select the upper window. Type this command:

nc [-u] -l -p port

where port = listening port number, known to your remote friend.

(Square brackets indicate an optional parameter. The "-u" switch is
optional. It causes Netcat to use the UDP protocol, which is sometimes
desirable for its relative "stealth," as when tunneling thru a

Now select the lower window. Type this command:

nc [-u] ipaddress port

where ipaddress = the remote IP address
port = the remote port number

(The -u switch is necessary if your chat partner is using UDP.)

The same commands may be entered in the Start...Run dialog, which will
cause the DOS windows to appear. They can also be created as shortcuts.

Assuming your chat partner has opened corresponding DOS windows and used
corresponding commands, you may now each type text in the lower window.
You will each see the other's transmissions in the upper window. Lines
of text are transmitted each time the key is struck.

When sending via UDP, I've found that the sender must hit Enter once
before display begins at the other end.

Ctrl-C will close the connection and exit Netcat. If you've run the
command from the Run dialog or a shortcut, the DOS window will close

If you're using TCP and close your sending or receiving Netcat, the
corresponding Netcat at the remote end will close also. UDP doesn't
have this effect, being "connectionless."

If you're behind a NAT router, you must first set up tunneling,
sometimes termed a "virtual server"; directing the desired port/protocol
on the WAN to your own machine's IP/port on the LAN.

You can make a connection to your own machine by using your own IP
address. Handy for testing.

This also works between machines on the same LAN.

Thanks Natasha!
This comment has been removed by a blog administrator.
Netcat v1.10

Download windows version directly from:
Post a Comment

<< Home