I am new to scapy and pcapy. As a project I have to send an ICMP pa开发者_JS百科cket using scapy and capture it using pcapy. I have to compare timestamp between sender and receiver to calculate delay in network.
I have no clue how can I do this. Any help will be greatly appreciated.
Thank you.
Following command i used to send ICMP packet to destination where i have used type 13 for timestamp.
a=IP(dst="172.24.50.76")/ICMP(type=13)
sr1(a) Begin emission: Finished to send 1 packets.Received 1 packets, got 1 answers, remaining 0 packets
ts_ori=22:40:35.556 ts_rx=526:4:13.700 ts_tx=526:4:13.700
1)Above ts_rx and ts_tx timestamp showing the same time, so how can calculate delay? 2)Secondly how can i increase the size of packet as I hv to calculate delay with different packet size.
I hope it is clear to you.
Basically, insert the current time at the sender into your payload and then compare it with the time when the packet was received. This will require the clocks on the two machines to be synchronised (e.g., with NTP). You will also need to take into account the time it takes the OS on the sender to take the packet from your code and actually send it, and the time for the receiver to parse the incoming packet and give it to your code.
Alternatively, you might be able to do something with the ICMP Timestamp message.
精彩评论