C
C#2y ago
CC8

❔ limit network usage of a process

is it posible to limit the network usage of a certain process? and if it is how can it be done?
7 Replies
Suiram1
Suiram12y ago
there are different ways to achieve this. One is to use the Windows Firewall API. Exactly how you might write a method to limit the network usage of a process depends on what exactly you want to do.
CC8
CC8OP2y ago
well I got a forms up and eas thinking of having a textbox where I could type the limit in bytes and activate that when the checkbox is checked. also the process i want to limit will be hard coded somewhere
Suiram1
Suiram12y ago
public static void LimitNetworkUsage(process process, long limitBytes) { // Set the process's priority process.PriorityClass = ProcessPriorityClass.BelowNormal; // Set the process's ProcessorAffinity process.ProcessorAffinity = (IntPtr)1; // set the limitBytes process.MaxWorkingSet = new IntPtr(limitBytes); } public static void RemoveLimit(process process) { // Set the process's priority process.PriorityClass = ProcessPriorityClass.Normal; // Remove the limit process.MaxWorkingSet = new IntPtr(-1); } These two methods must be able to add and delete a network usage limit for a process
CC8
CC8OP2y ago
thanks ✌🏻
D.Mentia
D.Mentia2y ago
Don't use ChatGPT to answer people's questions... that limits the memory usage, not network. ChatGPT is basically always wrong
CC8
CC8OP2y ago
catfacepalm
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server