Traffic Shaper

Home Forums Discussions General Traffic Shaper

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9292
    Zohar
    Participant

      Hello guys, need help using WinpkFilter, i want to limit download/upload speed for every IP connected, there is a sample in deplhi or c++? thanks

      #9293
      Vadim Smirnov
      Keymaster

        I think you can take a look at WAN Emulator sample code. The part responsible for packet delay is very similar to what you need to do to implement bandwidth limiter.

        WAN Emulator (PacketDelayerLayer.cpp) has two packet queues, one for incoming packets and another for outgoing. All intercepted packets first are placed into these queues and sent out from these queues by two dedicated threads after delaying packets for the specified number of milliseconds.

        To limit bandwidth for the specified IP address you should do very similar things by queueing packets, but instead of delaying each packet for the fixed amount of milliseconds you should first calculate the time passed since last send operation, then calculate the amount of data which would be passed for the particular IP address during this time using you bandwidth limit parameter and then send out as many packets as it fits into the calculated amount of bytes.

        Hope it helps…

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.