Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:37:26+00:00 2026-06-04T04:37:26+00:00

I am having trouble making calls to multiple URI’s , currently this works in

  • 0

I am having trouble making calls to multiple URI’s , currently this works in its current form but if the site is unreachable (does not exist) it breaks the other calls where I need it to just ignore and continue . This was built of a single posting method , but now the requirements have changed.

I have little experience with threading but this is what I’ve done to create the threads.

  private void makethread(string Url, string useproxy, string xml)
{
    //Parameters given put into list and passed with Thread.
    var urls = new List<string>() { Url, useproxy, xml };

    //Create thread

    Thread t1 = new Thread(new ParameterizedThreadStart(HttpPost));
    t1.Start(urls);


}

  public void SetUrls()
{
    String Url;
    int count = 1;

    string xml = CreateXML();
    string useproxy = "(none)";
    do
    {
        Url = objIniFile.GetString("Post", count.ToString(), "(none)");
        useproxy = objIniFile.GetString("Post", count.ToString() + "Proxy", "(none)").ToUpper() ;
        if (Url != "(none)")
        {

           // HttpPost(Url, xml , useproxy);
            makethread(Url , useproxy , xml);


        }
        count++;
    }
    while (Url != "(none)");
}

SetUrls grabs the URL and if it needs to use the proxy or not and passes it to the make thread method above which passes the xml , uri & proxy as an object to HTTP Post.

  public void HttpPost(object urls)
{

    string url= "none";
    string xml= "none";
    string useproxy = "none";

    int count = 0;
    //Splits Object to list and populate variables 
    foreach (var item in urls as List<string>)
    {
        if (count == 0) { url = item; }
        if (count == 1) { useproxy = item;  }
        if (count == 2) { xml = item; }
        count++;
    }

    string vystup = null;
    string proxy = ProxyAddress;

    string postData = xml;
    //--------------

    try
    {
        HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
        HttpWebRequest.DefaultCachePolicy = policy;


        byte[] buffer = Encoding.UTF8.GetBytes(postData);
        //Initialisation
        HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
        //method is post

        if (useproxy == "ON")
        {
            WebProxy myProxy = new WebProxy();
            // Create a new Uri object.
            Uri newUri = new Uri(proxy);

            // Associate the new Uri object to the myProxy object.
            myProxy.Address = newUri;
            WebReq.Proxy = myProxy;
        }

        WebReq.KeepAlive = false;
        WebReq.Method = "POST";
        WebReq.ContentType = "application/x-www-form-urlencoded";
        //The length of the buffer
        WebReq.ContentLength = buffer.Length;
        Stream PostData = WebReq.GetRequestStream();
        //write, and close.
        PostData.Write(buffer, 0, buffer.Length);
        PostData.Close();

        //Get the response handle
        HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
        //Let's show some information about the response
        Console.WriteLine(WebResp.StatusCode);
        Console.WriteLine(WebResp.Server);

        //Do not worry about response!.
        //read the response (the string), and output it.
        Stream Answer = WebResp.GetResponseStream();
        StreamReader _Answer = new StreamReader(Answer);
        vystup = _Answer.ReadToEnd();


        // MessageLog("Finished Posting " + DateTime.Now, "INFO");

        if (vystup != "OK")
        {

        }
    }
    catch (WebException ex)
    {

        Console.WriteLine(ex);
    }



}
#endregion

If I have 2 working URL’s it works . If I try 3 urls (where the 2nd is invalid) the first one will finish but the other will not, even after the 2nd thread exits due to timeout!.

I presume I am not using the threads correctly but I cannot see where any help would be appreciated .

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:37:28+00:00Added an answer on June 4, 2026 at 4:37 am

    You need to raise the number of concurrent connections, either via the config file or via this property: DefaultConnectionLimit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having trouble making 1 mass showhide for multiple documents. This showhide must be
I'm having serious trouble figuring out what is making certain function calls ambiguous and
I'm having trouble with the way I designed this little report I'm making. Is
I am experimenting with making Blackberry widgets but having a little trouble. My first
I'm having trouble with this simple scenario. First, I'm using ASP.NET WebForms. I'm making
I'm having trouble making this work: $(function() { $(.button).click(function() { var newentry = $(input#entry).val();
Having Trouble making sql connection. this is my code private static SqlConnection GetConnection() {
The picking itself is easy, but I'm having trouble making sure I can't place
I am having trouble with inconsistency making API and RSS calls to Twitter status
Im having trouble making my table contents vertically aligned and was wondering if you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.