If you have a port 1234 and this port is used by an application which sends data over the net, how could you listen on this port, to receive this data?

I've made an application which containes 2 chat parties.
I want to monitor the traffic, which is running, when I write something and send it to the other one.

This is important because the sent information should be logged to a logfile.

Do you have any suggestions for this?

thx, vbzero