Chat using Netcat

This post is regarding Netcat. Netcat is a networking service for managing network connections using TCP or UDP. It is often reffered to as the Swiss Knife TCP/IP. Another modern implementation of Netcat is Nmap’s Ncat. Although it comes with added features with nmap’s mature network libraries, it lacks some reverse compatibility issues with netcat.

Netcat is a tool that may enables us to gain control over the network with its arsenal of features. Here I am going to demonstrate how to establish a simple chat session using netcat.
As usual i am using Ubuntu 12.04. I comes enabled with the openBSD version of netcat. This may not support all the commands you may find on the net. You can change it to traditional version using the following command

$ update-alternatives --config nc

Step 1: Start Listening

This chat session works as a client-server model. We need to start listening to a port from the server. The command for start listening is

$ nc -l -p  <port_number>

Step 2:  Start Chatting

Any client can connect to this server and start chatting. For connecting the have to use nc command with the IP and port number to which the server is listening.

$ nc <server_ip> <server_port>

All done…. Now you can start chatting.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s