Search code examples
websockettcpdump

how to capture network traffic in the pcap file using tcpdump command?


I want to capture network trafic of my application using tcpdump command.

I'm implemented the Websocket client and server, in which server is sending messages to the connected clients continously. So in that scenario I just want to capture this messages in one pcap file.

previously I used this command which is not working properly :

sudo tcpdump -ni eth0 -s0 -w mycap.pcap

Can anyone told me how to capture such type of network traffic using tcpdump command?


Solution

  • Your syntax is correct.

    Are you receiving an error, or is your file "mycap.pcap" empty?

    If your file is unexpectedly empty, check if you have another interface that is receiving the traffic.

    If all else fails, try -i any for the interface.