Can you please tell me how to get the time to send the received packet using the pcap library? If so, then the capture time is determined:

pcap_pkthdr header; time_t local_tv_sec, local_usec; local_tv_sec = header.ts.tv_sec; local_usec = header.ts.tv_usec; 

A need to send. Thank you in advance.

  • generally speaking - no way, in the ip package there is no timestamp at all, and in TCP there is usually a monotonous timestamp from an arbitrary point in time. And yes, this is not a time to receive, but a time to capture a packet ... - Fat-Zer
  • Corrected. Forgot to clarify is supposed to capture UDP packets. It is a pity, if not. - Vaycheslav
  • with UDP, the more so because the header is even easier ... only if some application protocol itself inserts a timestamp ... - Fat-Zer

0