Exemplo n.º 1
0
        private void MyPacketHandler(IntPtr param, IntPtr /* pcap_pkthdr* */ header, IntPtr pkt_data)
        {
            DateTime tm;

            if (header != IntPtr.Zero)
            {
                PCAP_PKTHDR PktInfo = (PCAP_PKTHDR)Marshal.PtrToStructure(header, typeof(PCAP_PKTHDR));
                /* convert the timestamp to readable format */
                tm = new DateTime((PktInfo.tv_usec));

                Console.WriteLine("{0}, len: {1}", tm.ToShortTimeString(), PktInfo.len);
            }
        }
Exemplo n.º 2
0
 public static extern int pcap_sendqueue_queue(IntPtr queue, PCAP_PKTHDR header, IntPtr data);