Ask a questionAsk a question
 

QuestionAbout multithread in callback

  • Monday, November 02, 2009 11:34 AMwhossa Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi paul
       Basically, I found the callback is got called one by one, yet the processing performance need us to do our own raw parse and may be, use ThreadPool in callback, and let workthread to do filter and make call back return as fast as possible. 

       Howerver, when calling NmAddFrame in sub thread,  hRawFrame passed from callback is a problem, it should be valid and point to a handle table in one callback, yet may got changed when next callback comes. How could I keep or dup it so that the next callback comes, it's still valid, seemingly, only simple assignment or DuplicateHandle could not work. 

      If keeping or duplicating hRawFrame HANDLE unavailable, may be we should write data into cap file for ourself. Jessus!

      

All Replies

  • Tuesday, November 03, 2009 7:14 PMPaul E LongMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    You should call NmAddFrame in the callback and do nothing else.  Then in your worker thread, open the capture file and read the frames from there.  You will also have to provide some kind of synchronization to make sure you only read frames that are there.

    The "Filtering Live Data and Retrieving Data Fields" example in the help file shows one way of doing this.

    If I've misunderstood your question, please let me know by replying to this thread.

    Thanks,

    Paul

  • Thursday, November 12, 2009 7:19 AMwhossa Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Currently, the problem is that we must capture our interested information in a proxy server with huge traffic, so i'm trying all things to make our capture service meets the perf requirement, yes, the NemonAPI is 3.4 not 3.3

    I'm now realizing that to capture frames in a multithread way is impossible due to the working mode of Netmon. Yet, read cap file using multihread is feasible, Thank you for the reply!