This project is read-only.

HandlePacket delegate thread

Apr 27, 2010 at 8:59 AM

Hi,

first of all, very nice and useful project :) .

Just one question: I'm guessing why the HandlePacket delegate runs on the main application thread. To avoid application hang, I had to call ReceivePackets method using a BackgroundWorker class, to force the delegate to run on a separate thread.

Was something desired, or did I just make something wrong?

Thank you,

Marco 

Apr 27, 2010 at 4:46 PM

Hi Marco,

You can use the methods in any way you want.

It is very reasonable to use it using a BackgroundWorker or a different way (.NET Threads, ThreadPools, .NET4.0 Tasks) in order to keep an application from hanging.

One of the ideas behind the design of Pcap.Net is to not decide on how you want your application to multithread. The multithreading is completely up to the user of Pcap.Net.

 

I hope this answers your question.

 

Boaz.

Apr 29, 2010 at 7:27 AM

Ok, thanks a lot, it was just curiosity :) .