How to Create a Chat Server with Netcat

by Chinmoy Kanjilal | Translate | Print
Thursday, 29th Oct 2009 | Share


Share How to Create a Chat Server with Netcat on Twitter Share How to Create a Chat Server with Netcat on Facebook Save How to Create a Chat Server with Netcat To Delicious Favorites Stumble How to Create a Chat Server with Netcat Share How to Create a Chat Server with Netcat on Digg Get Instant Updates as RSS Feeds from Techie Buzz

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.



Share

No Responses so far | Share Your Opinions!

Leave a Comment

Note: We discourage users from using keywords in their names while posting comments, most of them get caught by spam, also it really would be more fruitful in knowing people who comment by their real name, rather than by using a name no one relates to. In future we reserve the right to delete comments from users using a name other than their own.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>