Wonter
Wonter

Reputation: 343

Why is packets by received from socket less than captured by Wireshark?

I got a very strange problem.

My code only received 87266 packets, but there are 167917 packets in Wireshark

This is my code(python3):

counter = 0
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(10)
sock.bind(('', 57130))
while True:
    try:
        data, _ = sock.recvfrom(4096)
        counter += 1
    except socket.timeout:
        break
print(counter)
exit(0)

It output 87266

But in Wireshark i got 167917 packets

enter image description here

I marked all of packets that dstport == 57130 and export them to a file, then open this file, so these No. are successive.

My OS is Windows 7

Upvotes: 0

Views: 94

Answers (1)

Zac67
Zac67

Reputation: 2912

There may be a network filter driver that intercepts specific frames so that Wireshark can't see them. They're counted by the NIC driver but not in Wireshark.

Upvotes: 0

Related Questions