wireshark captures native packets
When developing, I usually use my own machine as the client and server. At this time, wireshark cannot capture the traffic of the local machine by default. Wireshark can only capture the traffic passing through the network card, excluding local loopback addresses such as localhost, so I want to To capture local packets, you need to use the ip address of the actual network card. The specific method is as follows:
1. The administrator runs cmd
2. Execute the following command
route add local ip mask 255.255.255.255 gateway ip
Use ipconfig to view local ip and gateway ip
3. Change localhost or 127.0.0.1 to the actual ip address in the client program
4. Use wireshark to capture the local package