Sending messages over the Internet can be fun (we are doing it now). However, testing that connections are correctly established behind a mask of firewalls, load balancers and application servers can be challenging. Netcat offers a simple way to test the sending of messages between two servers and it is already available on the majority of server installs.

Using netcat is relatively straightforward. The core thing we are doing here is using both UDP -u and listening -l. So when you use the command netcat -ul you are telling netcat to listed on UDP rather than TCP.

Process

  1. Start netcat to listen on UDP port 100 on app server 1: netcat -ul 100
  2. Start netcat on local machine to send messages to app servers: netcat -u 192.168.0.1 100
  3. Send messages from local machine (type anything and press return) hello world

The message should appear on the app server (depending on how they are configured to deliver packet depends which one gets that message).

=== Listening server ==============================
$ netcat -ul 100
hello world
I am netcat
the fantastic

=== Talking server ================================
$ netcat -u 100
hello world
I am netcat
the fantastic

I should probably add that if you are testing TCP connections, I normally prefer to do that using telnet (not sure why, I guess legacy memories), however, you can do this using netcat if you wish.