> Home
Work
> Projects
Links
About Me
About This Site
Donate
Site Map
urticator.net
Crayons
Myth Plug-Ins
|
|
Socket Tap
Here's a nice little Java application I wrote a while ago, one that taps socket communications and logs them to files.
Tap.zip
It's not a tap in any covert sense, since it requires that the client be redirected, but I still think it's still correct to call it a tap. I guess one could also call it a proxy server, one that runs on a single port and writes log files.
Here's what I put in the readme file.
Usage: tap <listen port>
<target host> <target port>
<base output file name>
The program listens at the specified port.
For each incoming connection, a new
outgoing connection is made to the target,
and data are passed through bidirectionally.
All data are also written to log files
with names generated from the base name,
one file per connection and direction.
I've found the program to be particularly useful for diagnosing bad mail connections. When my mail client produces an uninformative error, I can just redirect it to a tap and reproduce the error, then consult the logs to see what's really going on.
Finally, here are some miscellaneous technical notes.
- The one thing I'm not completely pleased with is that for any given connection, there's no automatic way to correlate the contents of the two log files. It would be possible to do something about this, but none of the methods I've thought of are beautiful enough to be worth spending time on.
- In some applications, it might be annoying that the log file numbering starts over from zero every time, but that hasn't been a problem for me.
- The code is pretty clean by my standards, but I'd welcome suggestions, especially ones about the thread logic.
- The code was written to the Java 1.2 API.
- The build order is important; a Windows batch file is included.
|
|
|