problem with countinue the capture after break

Dec 23, 2013 at 6:14 AM
I am working with pcap.net.

I have a communicator that recieves packets. At some point I call the Break() function to stop the capture. after I stopped the capture, I want to continue the capture at some point..

I tried using the RecievePackets(HandlePacket, 0) again, but my GUI froze.. my code:

private void StartCapture()
{
_Communicator.RecievePackets(HandlePacket, 0);
}

private void StopCapture()
{
_Communicator.Break();
}

also importnat to say that all of this code is done not from the GUI thread.

the first time I start capture it works. then I break the capture. and after this. I try the _Communicator.RecievePackets(HandlePacket, 0) again and it freezes the GUI and everything.


any help?? thanks
Coordinator
Dec 29, 2013 at 4:06 PM
Hi ofekagmon,

This seems like a GUI issue rather than a Pcap.Net issue.
When you call ReceivePackets() you do a blocking call, so it will hold this thread.
If you'll change this call with an infinite loop, it would also hold the thread and I imagine it would also make your GUI freeze.
Can you try that and see?

Boaz.