0

I need to know what APIs I can use to make the following happen:

  • I have an existing process running on a Windows machine (call it application A), which can be any existing process on this Windows machine.
  • I want to code another application to throttle the bandwidth usage of A (call it application B).
  • B should be able to throttle A's cumulative upload and download speed separately. For example, if A has a maximum of 5 Kbps allotted to upload, then all of A's upload streams will be capped to a cumulative amount of 5 Kbps.

My requirements:

  • I cannot use a kernel-mode driver.
  • I need to make it a universal solution, so B can throttle any other process on a system (in other words, I can't change the source code of A).

I have tried to research into this, especially on Stack Overflow but could not find anything useful for my case:

  • I have seen this example of using a ThrottledStream class wrapper around a Stream object that will introduce throttling when used, but I need this to be a universal application, so I cannot use this approach (I can't change the source code of A).
  • I have seen this question who's answer speaks about using the Windows Filtering Platform API. Unfortunately, a requirement I have is that I absolutely can't use a kernel-mode driver to accomplish this, and my understanding is that the WFP API requires one.

Does anyone know what APIs can I use for my specific bandwidth throttling requirements in order to make B throttle the bandwidth usage of A?

Community
  • 1
  • 1
Alexandru
  • 12,264
  • 17
  • 113
  • 208
  • IMO you'll have better luck at [SoftwareReqs.SE](http://softwarerecs.stackexchange.com/), I also don't suggest posting this a 4th time if this gets closed. – Borgleader Dec 16 '14 at 20:13
  • @Borgleader I thought that site was for software recommendations. Is it also used for API recommendations? – Alexandru Dec 16 '14 at 20:18
  • 1
    Since you've closed off the obvious solution, I don't see any point in asking the question. The other apps make direct kernel calls, so if you're not going to intercept them in the kernel, I don't see.. – Martin James Dec 16 '14 at 20:25
  • @MartinJames I was worried that might be the case. I'm sorry if it seems like I'm trolling or something; I'm not. These are just the requirements I'm facing at the moment and I've never dealt with bandwidth throttling before, so I wanted to ask people who know better than me, like yourself. Mind if I ask where you remember seeing a bandwidth limiting application make direct kernel calls? Were you monitoring API calls or did you come across some source code with this functionality? – Alexandru Dec 16 '14 at 20:31
  • This question is silly. OSs deliberately don't let you do this, by their very purpose of existing, and you seem to know this already. – Lightness Races in Orbit Dec 16 '14 at 20:32
  • 1
    MS Detours could do it on Windows, but it's kernel level. – Martin James Dec 16 '14 at 20:33
  • 1
    If you could intercept API calls from other processes in user code, it would be a security disaster. If that's what you want, write it in Java:) – Martin James Dec 16 '14 at 20:36
  • @MartinJames Thanks! I was trying to interpret what Lightness meant in his comment; you've just explained it. :) – Alexandru Dec 16 '14 at 20:38
  • @MartinJames My requirements have changed a bit and as a result, have led me to spawn a new question. I took a wrong approach with this question. Please check this out, and let me know if you have any ideas: http://stackoverflow.com/questions/27514288/what-apis-can-throttle-bandwidth-on-an-application-domain-level-in-windows-in-u – Alexandru Dec 16 '14 at 21:33

0 Answers0