Can't open more than 2 TCP connections

Hi,

I'm trying to open number of HttpRequests to a URL, and i'm watching with TCPview and i'm seeing only 2 connections. even when i'm trying to open 4 (With threads..) My App only open 2.

Anyone can help

Thanks.



Answer this question

Can't open more than 2 TCP connections

  • Herru Perdana

    This is by design and as per the HTTP RFC which dictactes a client should make no more than 2 concurrent connections to a given host. If you wish, you can up this limit. Please see: ServicePointManager.DefaultConnectionLimit or the System.Net section of application configuration files.

    I have blogged about this as well, please see: http://blogs.msdn.com/mflasko



  • EsteemDE

    In order to increase the limit to up to 10 concurrent connections for example, add the line before creatting the HttpWebRequest

    ServicePointManager.DefaultConnectionLimit = 10;
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(http://www.msn.com);

    You could do the same from config. You can find more info on how to do this in the blog Mike's pointing you to. It is very good.

    Mariya


  • Zero_

    I have'nt understood something. I'm Using HttpWebRequest class (.NET 2.0)

    And by using more than 2 threads , on each thread:

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(http://www.msn.com);

    Now i only see max of 2 connections, and i did not understand what should i do on my side (client side).

    Thanks


  • Can't open more than 2 TCP connections