Wednesday, March 5, 2008

netcat: debug your network applications

It is hard to debug client application w/o modifications in server(client) application or writing third-party tool. The resolution you may want - a ready-to-go application that emulates network listener to which you can connect client and interact with it. Such application exists - netcat. To run a telnet session on port 1234 just run

nc -l -p 1234

and connect to port 1234 with your client application. Now you can send messages to client and receive them from it. To use UDP protocol just add -u argument for nc. Usually it's easy to debug server application that uses TCP protocol just by connecting them using telnet and emulate client protocol. Using netcat you also can send UDP messages to server:

nc -u 1.2.3.4 1234

. Project home: http://netcat.sourceforge.net/

No comments: