• 0

[C#] WebRequest Limiting Concurrent Connections


Question

I've got a multithreaded application to parse out some imageboards and download images based on custom rules I input. I'm using WebRequest and WebResponse objects to do the downloading.

However, I've hit a problem. It seems that it's limiting the number of concurrent connections per domain to 2. Is there any way to override this and increase the amount?

4 answers to this question

Recommended Posts

  • 0

In its default configuration .NET allows 2 concurrent connections, but you can change that in your configuration file:

<configuration>
  <system.net>;
    <connectionManagement>
      <add address="*" maxConnection="<number of connections>" />
    </connectionManagement>
  </system.net>;
</configuration>

The thing is, its actually part of the HTTP protocol that defines that a client shouldn't issue more than 2 requests at a time:

  Quote
Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

Hope that helps.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.