Log In    |    Knowledge Base    |    4D Home
Tech Tip: Watching TCP Traffic under Mac OS X
Published On: December 21, 2001

When you are doing Web development, you will often want to see the TCP traffic that is exchanged between different applications. For example, when your Web browser sends data to 4D, what exactly is it sending - more specifically, what is in the HTTP header? And, likewise, what is 4D sending back to the User-Agent that calls it?

To do this on Mac OS X, you can obtain a UNIX program called tcpflow. Look around for it (version 0.20); it is available from several sites on the Web. Once you have it installed, go to the OS X Terminal. Navigate to the directory the file is installed in, and type:

sudo tcpflow -i en0 -c

The "sudo" is "Super User Do" - which gives you full privileges to run
the next tcpflow.
-i specifies the network interface to use
-c specifies that the output should be dumped to the terminal window

You could also write:

sudo tcpflow -i lo0 -c

to specify the "loopback" interface, and to monitor traffic on your own computer.