473,395 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ServicePointManager limit download?

Hi,

I'm writing software which should download some files. I want to limit
the number of simultanioulsy downloads to two. I'm using the
ServicePointManager object for this. But I still can download more then
two files at the same time. When I use perfmon with the counter "Web
service/current connections" the number of connection are more then
two. And I am sure that I am the only user ;-)

In the init of the application the following code will be called:

Dim uri As New Uri("http://server/file.zip")
sp = ServicePointManager.FindServicePoint(uri)
sp.ConnectionLimit = 2

ServicePointManager.DefaultConnectionLimit = 2

After this I start e.g. 10 threads with the following code:

Dim myReq As HttpWebRequest
myReq = WebRequest.Create("http://server/file.zip")

myReq.Credentials = CredentialCache.DefaultCredentials
myReq.Method = "GET"
myReq.ConnectionGroupName = "MyGroup"

Dim myResponse As HttpWebResponse = myReq.GetResponse()

Dim stream As Stream = myResponse.GetResponseStream()
Dim bytes(1024) As Byte

While (stream.Read(bytes, 0, 1024) > 0)
End While

myResponse.Close()

By the way: what should happen when I execeed two connections? Should
an exception be thrown? Or will the other downloads wait?

May 11 '06 #1
1 1765
I found it!
I was testing with a local website on the same machine as the test
application....
When I changed the url to a remote website the connections were limited
to 2.

Hmmm I didn't find this in the documentation ;-)

May 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nicolas C. | last post by:
Hello, I'd like to make some download speed limitation on some of my files using PHP. I know that an Apache module can do that, but i cannot access my ISP Apache configuration. My idea was to...
1
by: Nicolas C. | last post by:
Hello, I'd like to make some download speed limitation on some of my files using PHP. I know that an Apache module can do that, but i cannot access my ISP Apache configuration. My idea was to...
9
by: James Macbell | last post by:
I think I have pushed ASP.NET to the limit, I am not sure if I have done anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here...
12
by: chipgraphics | last post by:
:confused::confused: I have been on the quest to find a php script that can serve files for downloads and limit the speed at which the file is transfered to the user. I want a faster download...
4
by: Molina | last post by:
Hi !!! I have a VB.Net application that consumes an WebService. The problem is that the HTTP address works fine, but it will change to an HTTPS address, and it isn't working. The weird thing...
4
by: tjfdownsouth | last post by:
I have a site that allows a person to log in and get a list of files to download for them. If the file size is under 65MB then everything is fine, they click the download button and the save box...
1
by: bigpoppa | last post by:
Hey, I need a script that will limit download speed and I want it integrated into the script I am using below. The script below forces downloads and hides url paths and logs stastics of downloads and...
16
by: Nad | last post by:
I have a very large site with valuable information. Is there any way to prevent downloading a large number of articles. Some people want to download the entire site. Any hints or pointers would...
3
by: Mathieu Prevot | last post by:
Hi, I have a multithreaded script that mainly creates several wget processes to download files. I would like to check/see and eventually limit the bandwidth of the pool of processes. One way to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.