Wednesday, September 02, 2009

SocketListener

What does it do?
SocketListener listens on an IP address and Port for inbound connections. If a connection is received any data received on the connection will be written to a binary logfile called "SocketListener.data" and a record of the connection is written to a text file called "SocketListener.log". In addition to recording inbound data without interpreting it at all; SocketListener can be configured to respond to connections with either an echo of inbound data or a binary data stream taken from a binary file on disk.

Where can I get it?
http://dl.getdropbox.com/u/293834/SocketListener.zip

What is it for?
1. A very simple TCP/IP server which can be very useful when testing the
configuration of firewalls and other network components because you know
that there is something listing on a specific IP and port.
2. Diagnosis of data received when developing interfaces. E.g people in france
say that they sent data in a particular format but your server didn't get it
in the same format and threw it out.
3. Testing of exception handling where the client receives ill formatted or
illegal data that the working server would never normally send back.
4. Any other case where one wants to very quickly have a look at the binary
data received or test the response handling in a client.

Why not use a sniffer? Because of the segmented nature of the networks nowadays one ends up installing sniffers all over the network to monitor what is mostly very simple traffic issues so although it *sort of* sniffs it is not meant to
replace a proper sniffer.

Compiling.
Assuming that you have a jdk installed, run the following in the src directory.
javac SocketListener.java
which will create a SocketListener.class in the same directory.

Running.
If you have compiled it yourself run it on any machine with a jre installed by:
java SocketListener [-p port] [-a IPAddress] [-o filename | -e]

If you are using the precompiled SocketListener.jar:
java -jar SocketListener.jar [-p port] [-a IPAddress] [-o filename | -e]

where parameters are:
[-p port] to listen on a port different from the default of 9021
[-a IPAddress] to listen on an IP address different from "0.0.0.0" i.e. all NIC's
[-o filename | -e] Respond to inbound connections with the contents of "filename" or respond by echoing the inbound data. Default is not to respond at all.

4 comments:

Heidi and Darrell Bergesen and kids said...

Ummm, are these your thoughts or your life?

Kirsten said...

You were much more interesting when you were on holiday! Perhaps you need another one!

Heidi and Darrell Bergesen and kids said...

OK, we've had 14 days of stupid socket listeners...
Time for something interesting? I'm with Kirsten here....

M.Elferink said...

Roland, I'm sure this is just a joke. Please share the punch line with us? Mom.