C# Collect packets in queue before processing them

Home Forums Discussions Support Portal C# Collect packets in queue before processing them

Tagged: , , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Vadim Smirnov 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9595

    ZiJer
    Participant

    I use a bit modified PassThru sample to process every packet.
    (it is marked with comment “HERE GOES THE PROCESSING OF PACKET” where i perform some actions with the packet)

    But I need to process packets when a certain amount of time passes or if the
    adapter packet queue reaches its limit.
    I think the best solution is to create my own queue in C# code, but i can’t realize how to store packets in it.
    So how can I do that?

    #9596

    Vadim Smirnov
    Moderator

    You must process the packet before calling

    Ndisapi.SendPacketToAdapter(driverPtr, ref request);

    The call above injects the packet into the network flow and processing does not make any sense after this point.

    If I understand you right then you are working over bandwidth limiter solution for outgoing traffic. So, instead of SendPacketToAdapter you should put packet into the queue (List<INTERMEDIATE_BUFFER> an example). A different thread can pop packets from the queue and call SendPacketToAdapter for them when time passes or queue reaches some predefined limit.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.