1

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();
}

any help?? thanks

Ofek Agmon
  • 5,040
  • 14
  • 57
  • 101

1 Answers1

0

I don't see the code of your GUI, but ReceivePackets() is a blocking call and will hold your thread.

If you're doing this inside the GUI thread, it will freeze your GUI. You should do it in a different thread.

brickner
  • 6,595
  • 3
  • 41
  • 54
  • I am not doing this from my 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. all of this is done not from the GUI thread.. any help?? – Ofek Agmon Dec 23 '13 at 07:05
  • I suggest replacing the call to ReceivePackets() with a different infinite loop. That will allow you to debug this regardless of Pcap.Net functionality. – brickner Jan 07 '14 at 19:34