Users can view and monitor the messages passed along in a TCP-based conversation, using the TCPMon utility in the WSO2 Carbon base platform. TCPMon is a simple and easy-to-use tool, particularly useful when developing Web services. It is based on a swing UI and works on almost all platforms that support Java. You can find the script file used to run this tool by the name tcpmon.sh or tcpmon.bat in the <PRODUCT_HOME>/bin folder. TCPMon needs JRE 1.4 or higher to run and has no dependencies on third-party libraries.
Usage Patterns of the Tool
As an Explicit Intermediate
The most common usage of TCPMon is as an intermediary. It is called explicit since the client has to send the messages to the intermediary rather than to the original endpoint in order to monitor the messages. The following figure explains this concept.
In order to start TCPMon in this configuration, you have to provide the target host name and port as well as the listening port on the Admin tab. For example,
Click 'Add' to open a new tab that displays the messages.
At this point, the requester should point to the listener port of the TCPMon instead of the original endpoint. For example, assume that we need to monitor all the messages that are sent to and from www.apache.org.
Add a listener with the host 'www.apache.org' and port 80. Set the listener to port 8080, which is any unused port in the local machine.
Point the browser to localhost:8080 instead of www.apache.org.
When the exchange of messages starts, it can be seen on the relevant tab.
The options at the bottom of the screen can be used to have the messages in XML format (useful in debugging Web services), save and resend the messages and also to switch the layout of the message windows.
As a Request Sender for Web Services
TCPMon can also be used as a request sender for Web services. The request SOAP message can be pasted on the send screen and sent directly to the server.
As a Proxy
TCPMon can act as a proxy. To start it in proxy mode, select the Proxy option. When acting as a proxy, TCPMon only needs the listener port to be configured.
TCPMon can simulate a slow connection, in which case the delay and the bytes to be dropped can be configured. This is useful when testing Web services.
Also, if HTTP proxy support is required, that can also be set on the admin screen.