Asynchronous programming RRS feed

  • Question

  • Hi Http recommends u cannot have more than two concurrent connections with the server from same client . I have a requirement which requires me to send multiple asynchronous service request using rest API .on an avg I need to send 5 req for one task and there are n number of such multiple task.If I cannot make more than 2 asynchronous request I.e. cannot have more than 2 concurrent connection how I wil achieve this? Also I cannot can machine config to increase connection count from 2 using servicepointmanager class because of server policy issues.
    Tuesday, February 12, 2013 3:50 AM


All replies

  • A connection consists of the following

    1) Source IP address

    2) Destination IP address

    3) Port number

    You cannot have two connections with all three items the same.  So one solution is to use a different port number for each concurrent connection.  If you can't use more than one port number the you have to develope a messaging language which supports your requirments.  So if you have more than one task you can put the task number into the message that you send like this

    Task No, request message\n           Terminate each message with a line return


    Tuesday, February 12, 2013 11:36 AM
  • I don't understand your answer. If I make a async call for a service , connection will be created internally, so how can I control port number assignment ? When I make more that 2 calls , other calls will be blocked and once conncection is released next request is punched to the server. HTTP 1.1 only permits 2 conncurrent connections . How can I override this value for a application ? Offcourse I can change maxconnection property at machine config file level, which will impact other applications. I want to override it for a console application , and changing it in app.config doesn't works because ServicePointManager is already initialized. How can I override that ?

    Tuesday, February 12, 2013 1:41 PM
  • Don' t get connections and service request confused.  A service request is a process and multiple request can be made on the same e e below


    Tuesday, February 12, 2013 2:00 PM
  • Hi,

    please visit this link :

    Hope this may help you.

    One good question is equivalent to ten best answers.

    Wednesday, February 13, 2013 9:08 AM