I've been writing about tracing http requests or other kind of connections, as this can be very helpful doing system integration work. And recently I discovered two other tools that I never used before.
The first one is netcat (also known as nc: if you are on a Unix box you can learn about it with "$ man nc" command).
With this tool you can do useful stuff to test network connection between components and/or manually simulate network services.
For example I can start a server socket on port 8000 issuing the command
# if you are running Linux version of netcat $ nc -l -p 8000 # if you are running BSD version of netcat $ nc -l 8000
Then I can trace http connections pointing my browser to http://localhost:8000/some/url
Netcat can also send back to the browser what you type on the console, so you can manually send bytes to the client.
This is the scenario I used to trace what my client was sending to an external http server offering some rest services. But still I think that tcpmon is more flexible to trace actual traffic between systems (see here for some examples).
With netcat you can manipulate network responses manually, for example to fake the server you want to connect to (if you know the protocol) and explore how your client software is behaving handling that response. Without forgetting that software tests must be automatic, with junit or whatever; the preliminary "exploring" task it's easier to be done manually, just to understand how things are working.
The second tool I discovered, tcpdump, is much more powerful and can be applied in cases when you cannot have a tool in the middle, like tcpmon.
For example you need to spy the traffic that is sent and received from a web server, to verify that the communication is going as you expect.
Then you use the command:
$ sudo /usr/sbin/tcpdump -s 0 -i eth0 -X port 80
Tcpdump will then connect to the kernel and will display an hex dump of the communication that is passing through the port 80 (web).
In this case you don't need to reconfigure the server, but you can just spy existing installations without modifying your software (thing that you can't do, for example, for production servers).
If you are running Linux, probably you have those two tools installed already.
One Response to “More on tracing network connections.”
Leave a Reply
Search
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Mar | May » | |||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
Archives
Categories
- Android (3)
- Apple (26)
- Books (7)
- Eclipse (14)
- Errors (3)
- Firefox (7)
- Git (2)
- Hardware (16)
- Horror Code (8)
- Internet (18)
- Java (98)
- JavaScript (9)
- Life, universe and everything (45)
- Lifehacks (25)
- Linux (50)
- Opinions (25)
- OSX (4)
- Python (1)
- Software (27)
- Speeches and Conferences (8)
- Unix (3)
- Web (21)
- Windows (19)
Tag Cloud
Android apple architecture Bash colors configuration CSS Development Düsseldorf Eclipse germany Git Google Hardware hdr How-To Java JAXB job junit Karmic Linux MacBook music night Open Source Opinion oracle OSX patterns Pitfalls Practices Resume Security Software Suspend TDD Testing tip tonemapped Tricks Ubuntu video Web XML
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Blog License
Blogs I like
Books on the desk
Friends' Blogs
- Antonio Terreno & Valter Bernardini
- Bruno Bossola
- Daniele Galluccio
- Domenico Ventura
- Ed Schepis
- Fabrizio Gianneschi
- Luca Grulla
- Luigi Zanderighi
- Marcello Teodori
- Mida Boghetich
- Muralidharan Chandrasekaran
- Piero Ricca
- Renzo Borgatti
- Simone Bordet
- Simone Bruno
- Uberto Barbini
- Valvolog
- Webtide blogs (Greg Wilkins & Jan Bartel)
Links




















Good post.