Friday, 25 January 2013

Netcat chat application

What is Netcat ?

Netcat is a tool used to communicate between machines using TCP/UDP protocol .An improved version of Netcat is Ncat. It is also a tool for communication. Netcat tool can be used in both linux and windows. The syntax used are same in both windows and linux.



Uses of Netcat 

1. Netcat can be used as a telnet program.


nc -v <ip address> <port number>

-v gives error if fails to connect with the target machine


2. Netcat helps to open  a new server socket means it can listen to a port for connection


nc -v -lp <portnumber>


-lp means 'listening to the port'


3. Netcat helps in transfering file from one machine to another.

Sender Side


cat <filename> | nc  <ip address > <port>


At server side 


nc -v -lp <port> > filename


Chat Application using Netcat


Follow the steps to create a chat application using Netcat.

Machine A

 nc -v -lp <portnumber>

Machine B

nc -v <ip address of machine A > <port of machine A>





No comments:

Post a Comment