|
using var client = new WebClient();
client.DownloadFileAsync(new Uri("https://speed.hetzner.de/10GB.bin"), "10GB.bin");
All I want is, when another user connects to the modem / router via wifi and starts listening music on Spotify or another usages, which need bandwidth, the method DownloadFileAsync decreases download speed until he/she is using bandwidth and increase it again when nobody is using bandwidth for a period.
|
|
|
|
|
What you are looking at utilizing is bandwidth throttling. This is not something you are going to be easily able to accomplish using DownloadFileAsync. If I were you, I would look at an article like this[^] instead.
|
|
|
|
|
I've read about bandwidth throttling, but main problem is that how can I detect internet usage to applying bandwidth throttling?
|
|
|
|
|
Songs are small enough, I don't think it matters (< 3 MB). The Media Element can be "paused", whether it downloads everything first, I don't know. If your queueing more than 1 file for 1 person, then don't.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Song was just a sample. I want to build a new download manager, so that whenever a user on the LAN or connected via wifi wants to open web page, watch a film on YouTube or gaming online, my download manager decrease download speed automatically.
|
|
|
|
|
Have you thought about applying QoS rules on the network (router)?
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
No, because some modem doesn't have QoS. I'm developing a new download manager and I want to decrease download speed whenever user starts using internet for opening website, listening music on spotify, gaming online or any other usages.
|
|
|
|
|
I was thinking on the lines of implementing it at the network level and not on the individual machines. Would seem to be a lot simpler to implement and would not be adding further load on your WiFi bandwidth
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
We don't have any access to Modem/Router's config and also All modems doesn't have QoS settings.
modified 9-Feb-20 2:40am.
|
|
|
|
|
Also, I'm a developer and here is CodeProject not Superuser. I want to make application for my users not changing QoS setting for my uses.
|
|
|
|
|
Sometimes you need to step back and look at the big picture; if you are having a problem with bandwidth it does not make sense to me to add to the network load in an attempt to regulate it.
And the correct spot would more likely be ServerFault
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
I want call dll functions in thread and it uses handle object for parameter.
If I call dll functions directly, then there is no problem.
But if I call it via thread, then runtime error occurs.
I think it will be because of handle object, so I have saved handle before start thread to static variable and use this value in thread.
But the problem is same.
Please help me.
|
|
|
|
|
All functions are called via a thread: a Thread is the basic unit of execution for an app and if you don't have a running thread, you don't have running code. Initially, your code will have a single running thread, and when they stops executing your app is closed - but you can add threads to do long running functionality without affecting the user display, or to increase the parallelism of your processing. In broad principle, there is no difference between the original thread and any you add, except in .NET only the thread that created Controls can access them.
But ... your use of "handles" implies you are actually not working in C#, but in C or C++ so you would need to ask this in a different forum.
Either way, you'd need to give us a much better explanation of what you are doing and how it is going wrong that you have: Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What runtime error are you seeing? Without this basic piece of information, any help will be guesswork at best.
|
|
|
|
|
What do your "calls" look like? You're implying you have 2 different ones.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Today, out of nowhere, I started getting this error when I run my app
System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint:
ContractName Views.MainWindow
RequiredTypeIdentity Views.MainWindow
I have made NO code changes. One minute it was running fine, the next - bam! error.
ALl of the Google search hits I found talk about some kind of Visual Studio problem, but this only happens when I RUN my app, not open it. And, the message sure smells like EntityFramework, which we're using.
The message mentions "ImportCardinalityMismatchException". Never seen this before.
I following the instructions in this SO post, I repaired VS, rebooted, and all that.
Anyone have any thoughts on this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Google points to MEF, not EF.
Kevin Marois wrote: this only happens when I RUN my app, not open it Any plugins loaded when the app runs?
c# - MEF composition import issue when using specific interface - Stack Overflow[^]
..and unless you have a hash from all libraries that your code uses, it is hard to prove that "nothing changed".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Ya I meant MEF not EF
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
So you're using MEF?
Did it "stop working" at the exact same time on other machines? Do you have yesterdays backup that you can try in a VM?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
my machine only. Nothing MEF related changed
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
Nothing you posted helped..Reread my posting
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You're hopeless.
It is a Microsoft error. However the resolution is this:
Clear the Visual Studio Component Model Cache. Delete or rename this folder:
%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache
or
%LocalAppData%\Microsoft\VPDExpress\11.0\ComponentModelCache
and restart Visual Studio. The issue will have been resolved.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
There's no place here for insults
go back and reread
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Quote: “No exports were found that match the constraint” error in Visual Studio
I could go on, but it's "hopeless".
The fact your "turn-around" time was so short, you:
a) didn't read it
b) and can't be bothered
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|