python – Scapy: measures the number of bytes of data transferred from the source to the destination

I use Scapy to send packets over a network, here is the code to send a package:

for i in xrange (1000):
packets = Ether () / IP (dst = generateDestinationIP (start, end), src = generateSourceIP ()) / UDP (dport = 80, sport = 2)
print (repr (packages))
#rstrip () removes the spacing characters from the end of the interface
sendp (packets, iface = interface.rstrip (), inter = 0.1)

Now, I want to measure Src_byes and Dst_bytes (Number of bytes of data transferred from the destination to the source in a single connection and vice versa). In addition, I want to count the number of connections to the same port number as the current connection in the last two seconds. How can I do it?