Click here to Skip to main content
15,886,857 members
Home / Discussions / C#
   

C#

 
QuestionFind all websites relevant to search word(s) that are at top of search list Pin
ASPnoob19-Nov-09 11:07
ASPnoob19-Nov-09 11:07 
AnswerRe: Find all websites relevant to search word(s) that are at top of search list Pin
Abhishek Sur19-Nov-09 11:19
professionalAbhishek Sur19-Nov-09 11:19 
QuestionGet arrival confirmation of sent mails using System.Net Mail SMTPCLIENT Pin
FJJCENTU19-Nov-09 11:03
FJJCENTU19-Nov-09 11:03 
AnswerRe: Get arrival confirmation of sent mails using System.Net Mail SMTPCLIENT Pin
Abhishek Sur19-Nov-09 11:22
professionalAbhishek Sur19-Nov-09 11:22 
GeneralRe: Get arrival confirmation of sent mails using System.Net Mail SMTPCLIENT Pin
Dave Kreskowiak19-Nov-09 15:29
mveDave Kreskowiak19-Nov-09 15:29 
GeneralRe: Get arrival confirmation of sent mails using System.Net Mail SMTPCLIENT Pin
Abhishek Sur19-Nov-09 20:35
professionalAbhishek Sur19-Nov-09 20:35 
GeneralRe: Get arrival confirmation of sent mails using System.Net Mail SMTPCLIENT Pin
Dave Kreskowiak20-Nov-09 2:16
mveDave Kreskowiak20-Nov-09 2:16 
Question"no overload for ... matches delegate..." Pin
bbranded19-Nov-09 10:53
bbranded19-Nov-09 10:53 
Hello,

This is my first attempt at writing an event handler.

I am writing a simple packet capture utility utilizing a .NET interface to the WinPCap lib.

However, I've come across an error and do not know how to solve it.

private void button1_Click(object sender, EventArgs e)
        {
            /* Retrieve the device list */
            List<PcapDevice> devices = Pcap.GetAllDevices();

            //Extract a device from the list
            PcapDevice device = devices[2];
            //Register our handler function to the 'packet arrival' event
            device.OnPacketArrival += new SharpPcap.Pcap.PacketArrivalEvent(device_PcapOnPacketArrival);
            //Open the device for capturing
            //true -- means promiscuous mode
            //1000 -- means a read wait of 1000ms
            device.Open(true, 1000);
            Console.WriteLine("-- Listenning on {0}, hit 'Enter' to stop...",
            device.Description);
            //Start the capturing process
            device.StartCapture();
            //Wait for 'Enter' from the user.
            Console.ReadLine();
            //Stop the capturing process
            device.StopCapture();
            //Close the pcap device
            device.Close();

        }

        private static void device_PcapOnPacketArrival(object sender, SharpPcap.Packets.Packet packet)
        {
            DateTime time = packet.PcapHeader.Date;
            int len = packet.Header.Length;
            Console.WriteLine("{0}:{1}:{2},{3} Len={4}",
            time.Hour, time.Minute, time.Second, time.Millisecond, len);
        }



new SharpPcap.Pcap.PacketArrivalEvent(device_PcapOnPacketArrival) throws an error:
"No overload for 'device_PcapOnPacketArrival' matches delegate 'SharpPcap.Pcap.PacketArrivalEvent'"

Here is some information that may prove useful:
"public delegate void PacketArrivalEvent(object sender, SharpPcap.PcapCaptureEventArgs e)
Member of SharpPcap.Pcap"


Also, I am referring to the outdate sample code located on the main site for the class wrapper.


How can I avoid this error? Any assistance is appreciated.


Thanks,

Matt
AnswerRe: "no overload for ... matches delegate..." Pin
Gideon Engelberth19-Nov-09 11:02
Gideon Engelberth19-Nov-09 11:02 
GeneralRe: "no overload for ... matches delegate..." Pin
bbranded20-Nov-09 5:39
bbranded20-Nov-09 5:39 
AnswerRe: "no overload for ... matches delegate..." Pin
Shameel19-Nov-09 17:58
professionalShameel19-Nov-09 17:58 
QuestionTreeview Pin
farokhian19-Nov-09 9:18
farokhian19-Nov-09 9:18 
AnswerRe: Treeview Pin
Christian Graus19-Nov-09 12:25
protectorChristian Graus19-Nov-09 12:25 
AnswerRe: Treeview Pin
Shameel19-Nov-09 18:10
professionalShameel19-Nov-09 18:10 
Questionwhen i have to use and when i shld not use generics ? Pin
md_azy19-Nov-09 8:05
md_azy19-Nov-09 8:05 
AnswerRe: when i have to use and when i shld not use generics ? Pin
Abhishek Sur19-Nov-09 8:36
professionalAbhishek Sur19-Nov-09 8:36 
AnswerRe: when i have to use and when i shld not use generics ? Pin
Pete O'Hanlon19-Nov-09 9:00
mvePete O'Hanlon19-Nov-09 9:00 
AnswerRe: when i have to use and when i shld not use generics ? Pin
PIEBALDconsult19-Nov-09 10:34
mvePIEBALDconsult19-Nov-09 10:34 
AnswerRe: when i have to use and when i shld not use generics ? Pin
Shameel19-Nov-09 18:18
professionalShameel19-Nov-09 18:18 
QuestionNeed help with DataGridView combobox Editing please Pin
Grimtaz19-Nov-09 8:00
Grimtaz19-Nov-09 8:00 
QuestionVisual Studio only displaying HTML instead of Design View Pin
W4Rl0CK4719-Nov-09 6:59
W4Rl0CK4719-Nov-09 6:59 
AnswerRe: Visual Studio only displaying HTML instead of Design View Pin
Sir Dot Net19-Nov-09 7:39
Sir Dot Net19-Nov-09 7:39 
AnswerRe: Visual Studio only displaying HTML instead of Design View Pin
Shameel19-Nov-09 18:03
professionalShameel19-Nov-09 18:03 
AnswerRe: Visual Studio only displaying HTML instead of Design View Pin
Ronni Marker20-Nov-09 10:53
Ronni Marker20-Nov-09 10:53 
QuestionListView replacement Pin
Vincent Roggero19-Nov-09 4:34
Vincent Roggero19-Nov-09 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.