Python Forum

Full Version: how to count a retransmission packets from pcap file?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can count the retransmission packets from a pcap file without using pyshark please ?

I use this code with pyshark :


def pyshark_retran_packet(inputfile):
	    capture = pyshark.FileCapture(inputfile, display_filter='tcp.analysis.retransmission')
	    counter = 0
	    for packet in capture:
  		    counter = counter + 1
  		
	    print ("Total number of retransmitted frames found = " + str(counter))
This code works but I need to list the packets in interval of 2 seconds (if my pcap file is composed of 20 sec, I get 10 values for retransmission) or use another way to count other than pyshark which