Network programming may be direct low level TCP communication or high level like RMI, HTTP, Web services, and etc., we may need to debug the message what and how it delivers in TCP layer. This will help us to debug and dig to chase the right tail. Sometime, we may see data incorrectly in receiving end due to network issues and we will start correcting our implementaion in server and client.
tcpmon is an open-source utility to Monitor A TCP Connection. In which, we can see the TCP layer data goes out of the box and also the response comes from the server. I have started using this tool to understand the structure of the SOAP message and HTTP headers. Specifically while going with encryption like MTOM/XOP, this tool helped lot.
If you want to count or see the content get transmitted while using browser to connect web application also, this tool helps lot.
We have to place this tool in between the server and client. For instance, I have to connect to application http://www.javafundu.com:7001/checkTCP. Here are the steps
- Double click the downloaded tcpmon.jar from tcpmon.dev.java.net
or run command java -jar tcpmon.jar
- In Create a New TCP Monitor connection, set Local port=8080, Server Name=javafundu.com, and Server Port=7001
- Click on Add Monitor. Now TCP monitoring started
- Start the browser, and type the URL as http://localhost:8080/checkTCP
- Now Request from browser and response of the same also captured in TCPMon and get displayed.