TCPMon – A Basic Tutorial

TCPMon is a nice little tool for testing TCP communication between a client and server. It is an open source project, distributed under the Apache 2.0 license.

Downloading and Running TCPMon

To download TCPMon, head over to the Apache TCPMon download page and download the binary distribution.

(There’s a Google Code Project called TCPMon too, but that’s not the same one, and has fewer features)

Once downloaded and extracted, navigate to the build folder and run TCPMon by executing on Linux or tcpmon.bat on Windows. (On Linux, you’ll need to set the execute bit on the sh file before you run it). Note that your current working directory must be the build folder, else Java will report a ClassNotFoundException

TCPMon as an intermediary between clients and a single server

I found TCPMon useful when testing a webservice client I was implementing – I wanted to be certain that it’s sending the right data, and also wanted to double check the server responses in a convenient way. Here’s what you need to do:

  1. Specify the listener properties. The listener port is any arbitrary port that you’d like TCPMon to listen to (and that any other process isn’t using). The target port is that of your webservice.
  2. Click Add

TCPMon admin tab - Configuring a listener

In the window that appears, you will be able to monitor connections between your client and server after setting up your client to point to TCPMon’s listening port. TCPMon forwards all requests to the target server, and you’ll be able to see the requests and responses as they occur.

Requests and responses in TCPMon

Checking the “XML Format” box adds appropriate indentation to any XML in subsequent requests and responses. This can make it easier to read.

TCPMon as a proxy server (an intermediary between clients and an outbound connection of the machine hosting TCPMon)

Another functionality is the use of TCPMon as a proxy – you can set up a proxy server on your machine using it, so that all requests from another device or machine are routed through the proxy.

I found this useful when testing on mobile devices that needed to connect to a VPN network accessible from my computer, but not from the device itself.

Here’s what you need to do to set up the proxy server:

Setting up a proxy server in TCPMon

To get a mobile device connected through this proxy, you’ll need to modify the proxy settings of your Wifi connection:

Setting up an iPad to connect to TCPMon

Now all requests from this device will be routed through the TCPMon proxy.

Note that TCPMon is useful only for simple testing of requests and responses – it fails to work on anything more than a small number of requests. You’ll need a dedicated proxy server for that.

Also, if you’re connecting to a single server, it’s best to go with the first approach of an intermediary rather than a proxy server, so that TCPMon doesn’t capture traffic you don’t need to inspect.

Sending custom requests

The “Sender” tab can be used to craft your own SOAP requests and send them. The fields under this tab are pretty self-explanatory:

Sending requests from TCPMon

– See more at: file:///C:/B/Backups/Technonstop/

What does the Amazon vs Flipkart Contest Herald for us?

When you’re out to shop online, there’s a greater variety than ever before if you’re in India!

Shopping giant Amazon has launched the curiously named in beta mode to target Indian customers. Presently, it is only a comparison shopping site rather than one that allows customers to order directly and obtain shipping from Amazon’s own dedicated courier services. Shoppers are taken to vendors’ individual sites to complete their purchases, and experiences may vary.

UPDATE (10th Feb, 2012): Amazon has been granted FDI approval to set up its logistics service in India.

Junglee means ‘of the forest’ in Hindi, and by all means, the offering at the first instant indeed looks to be just a subset of the vast forest that Amazon has become!

The move appears to be cautious, given the fact that Flipkart has achieved wide acceptance in the country, and a full-scale online shopping war of dominance is going to leave consumers frustrated.

Hanging Around on Junglee

I checked out a few camera deals on the new site, and found the comparisons impressive. It’s a good thing to see several aspects of multiple sellers like seller information, shipping rates and return policy nearly at once, and it would be even better if a summarized at-a-glance chart was provided.

Camera Deal on

What about the shopping experience? That will depend on the sellers and their past track records. For now, I’ll hang around on Junglee if I’m looking for something, but probably head over to the trusty Flipkart to hit the “Buy This Now” button.

It’s the same early mover advantage that stops Facebookers from migrating to Google+.

When will Amazon Stamp the Accelerator?

Amazon has chosen to mark its presence through a yellow-pages-cum-reviews shopping website, which is likely to help give good exposure to little known merchants.

That’s great news if you’re a seller seriously looking to expand.

In my opinion, what ultimately will make the difference is Amazon’s ability to match Flipkart’s low prices, timely delivery and the friendliness of trusted delivery personnel.

A quick look at the Amazon services page reveals tremendous promise for sellers. What can be more encouraging than “convert our traffic into your customers” and “no listing fees”?

The question is whether the individual merchants will help maintain the image Amazon needs to make it big in India.

Do you think Amazon will give Flipkart a run for their money? Will healthy competition in India boost the online shopping experience? We’d like to hear your thoughts!

The Meaning of dot slash for Running an Executable in Linux

The dot refers to the current directory. The forward slash “/” is the directory path separator.

So, when you type in ./filename at the shell, you prefix the filename with the path to the current directory.

Why do we need to do this when running any executable file?

When you run a command in the shell, it either runs it as a built-in command, or as an executable.

If it isn’t a built-in command, the shell tries looking for the executable in all the directories specified by the PATH environment variable – you can see what this contains by typing in echo $PATH in the terminal.

So if your file is in the current directory, the shell won’t find it – because the current directory is not included in the PATH by default. If you prefix the dot and the slash, the path to the file is passed to the shell, which looks for it exactly at the specified location. In fact, the shell doesn’t search the PATH at all when an absolute or relative path (other than just the filename) is specified.

Here’s something to try, but make sure you immediately undo it by exiting the terminal: Add the current directory to the PATH variable in your current shell by typing in

export PATH=$PATH:.

Now, you can run your executable without the dot slash!

WARNING: As noted in the comments below, this change has security implications. The above command will last only for the current terminal session – the changes to the PATH variable will be lost when you exit the terminal. Make sure you do not make this change permanent.

How about using the absolute path?

Since the dot slash helps the shell find the executable by specifying the directory, providing the absolute path without the dot prefix also works.

People might think you always need the dot to be prefixed, even when using absolute paths, but that doesn’t work because you end up prefixing the path to the current directory in addition to the complete path.

Note that you can also execute files using a relative path, in the form of <sub-dir>/<executable>, for example.

5 Ways to Boost Your Efficiency with Eclipse


Learn to use the shortcuts. Seriously!

Did you know that if you need to scroll suddenly while typing, you don’t need to reach out for your mouse? Just use the Ctrl or the Ctrl key combinations to scroll up or down.

To learn more about Eclipse shortcuts, head over to TechNonStop’s tutorial on Eclipse Shortcuts.


Templates are a must-learn – there are so many out there.

For example, sysout, syserr, and systrace.

Look up Window->Preferences->Java->Editor->Templates for all the pre-defined templates available, and don’t forget to add your own!

Often, those working on a single project would like to share templates they create so that the whole team enjoys the shortcuts.

Eclipse Preferences - Java templates

Tweaks to eclipse.ini

I’ve had a noticeable improvement in startup time and overall response times on my Eclipse installation by adding the following to eclipse.ini, at the bottom:


Source: Nerds-Central: Tuning The JVM For Unusual Uses – Have Some Tricks Under Your Hat

Also, tweak the Xms (initial heap size) and Xmx (maximum heap size) to higher values, depending on your RAM and the number of other running applications, or in the event that Eclipse gives you nasty “OutOfMemory” errors. 384m and 1024m respectively for Xms and Xmx work well on my 4 GB machine.

Note: The above optimizations are for Sun’s Java 7. If you use another JDK version, look up this thread for optimizations that have worked for others.

Useful Plugins

Mylyn is an excellent plugin to keep track of your TODOs. The Java EE version of Eclipse has this plugin installed, as well as others that are quite useful. Examples are the Web Page Editor for HTML editing, and the XML editor for XML editing.

Use your version control system’s plugin for Eclipse, so that code check-ins can be done from within.

The JDEclipse Decompiler plugin is useful for class decompilation.

Google’s CodePro Analytics is great to analyze and improve the quality of your code.

Eclipse color themes has a cool plugin for changing color themes.

There’s also this cool JSON Editor Eclipse Plugin.

Whatever plugins you use, ensure that you turn them off on startup. Go to General->Startup and Shutdown, and uncheck ALL plugins listed. Also, disable or uninstall the ones you don’t need.

Improve General Eclipse Knowledge

Did you know that you can use the Navigator View (rather than the Package explorer) to see all the files present, including .project files and the bin directory?

Did you know you could just paste exception stack traces into the Java Stack Trace console, and lines numbers turn into hyperlinks?

Use the documentation to keep improving your general knowledge on Eclipse, and for more tips and tricks!

Add shortcuts to related external tools

Yes, I did say 5, but here’s a bonus!

Using the External Tools Configuration window (accessible from the External Tools icon in the toolbar), add shortcuts to scripts that automate commonly run tasks.

For example, I have a script that does the following: syncs down latest code, builds it and runs the test cases after deploying the newly generated artifacts to a locally running server. Adding a shortcut to this within Eclipse has greatly eased the way I run the script and refresh my workspace after it completes.