Skip to main content

Use tcpdump to monitor tcp traffic between client and server apps

· One min read
Hreniuc Cristian-Alexandru

On the server side:

tcpdump -n -i interface -n "src host client-host.com and dst port server-port"

You can get the client host using lsof:

lsof -itcp -a -p server_pid

This will print all active tcp connections to the server app with the specific pid.

On the client side:

tcpdump -n -i interface -n "dst host server-host.com and dst port server-port"

interface can be taken via ip addr