How to Create a Chat Server with Netcat
By on October 29th, 2009

Netcat is a very powerful network utility for Linux. Netcat was developed in 1995 and has many advanced usages. It featured as one of the Top 100 network security tools of 2006 at rank #4.With netcat, we can perform numerous networking tasks like port scanning, managing connections and setting up servers. One very basic usage of netcat is shown here.

Create a chat server/Client:

Netcat can be used to create a chat server and client. With netcat, we can setup a computer as a chat server and another as a chat client which would connect to that server. This enables chatting between two computers on a network.

To create a chat server, enter this into a terminal:

nc l p port_number'

This will set up a tcp server on the host at the port specified as port_number’. This makes netcat listen to the specified port and relays the incoming message on the terminal with stdout. Connect to the chat server using:

nc server_ip' port_number'c

Now, any connection made to the server on the specified port will set up a chat client through the terminal with stdin.

If you are on a Mac, use only the l switch to create a chat server. So, your command should look like:

nc l port_number'

Connecting to the chat server on a Mac is the same as given above.

Author: Chinmoy Kanjilal Google Profile for Chinmoy Kanjilal
Chinmoy Kanjilal is a FOSS enthusiast and evangelist. He is passionate about Android. Security exploits turn him on and he loves to tinker with computer networks. He rants occasionally at Techarraz.com. You can connect with him on Twitter @ckandroid.

Chinmoy Kanjilal has written and can be contacted at chinmoy@techie-buzz.com.

Leave a Reply

Name (required)

Website (optional)

 
    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'advanced_comment' not found or invalid function name in /home/keith/techie-buzz.com/htdocs/wp-includes/comment-template.php on line 1694
 
Copyright 2006-2012 Techie Buzz. All Rights Reserved. Our content may not be reproduced on other websites. Content Delivery by MaxCDN