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.
netcat -ul 100
netcat -u 192.168.0.1 100
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.
Connect on LinkedIn. Follow me on Twitter. Grab the RSS Feed