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 7891529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:38:28+00:00 2026-06-03T06:38:28+00:00

I am having a problem where my code waits a long period of time

  • 0

I am having a problem where my code waits a long period of time on
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); What am I doing wrong? Sometimes I get bad proxies from my queue so I want to be able to timeout and skip.

        Boolean match = false;
        String clean = String.Empty;
        String msbuff;
        IWebProxy insideProxy;
        try
        {
            //grab proxies based on queue
            String proxyQueItem = Proxy_Que(_rankingConnectionString);
            insideProxy = new WebProxy(proxyQueItem);

            HttpWebRequest request = (HttpWebRequest) WebRequest.Create(ResultURL);
            request.Proxy = insideProxy;
            request.Timeout = 15*1000;

            using (HttpWebResponse response = (HttpWebResponse) request.GetResponse())
            {
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream streamResponse = response.GetResponseStream();
                    StreamReader streamRead = new StreamReader(streamResponse);
                    msbuff = streamRead.ReadToEnd();
                    //get rid of , -, (, )
                    msbuff = msbuff.Replace(" ", String.Empty).Replace(" ", String.Empty);
                    msbuff = msbuff.Replace("-", String.Empty);
                    msbuff = msbuff.Replace("(", String.Empty);
                    msbuff = msbuff.Replace(")", String.Empty);
                    //attempt to find phone number
                    match = msbuff.Contains(Listing.PhoneNumber);
                    streamRead.Close();
                }

            }
        }
        catch (Exception lk)
        { }
  • 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-03T06:38:30+00:00Added an answer on June 3, 2026 at 6:38 am

    If you have a queue of proxies and you just need to timeout and skip to the next one if it’s bad, then you could just loop until you get a response, catching the error and getting a new proxy off the queue each time through. Something like this …

    private string requestByProxy(string url)
    {
        string responseString, proxyAddress;
    
        while (responseString == null)
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                // set properties, headers, etc
    
                proxyAddress = getNextProxy();
    
                if (proxyAddress == null)
                    throw new Exception("No more proxies");
    
                request.Proxy = new WebProxy(proxyAddress);
                request.Timeout = 15 * 1000;
    
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                StreamReader sr = new StreamReader(response.GetResponseStream());
                responseString = sr.ReadToEnd();
            }
            catch (WebException wex)
            {
                continue;
            }
        }
    
        return responseString;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with some code I've written. I've had to anonymize it,
I'm having a problem with some code that used to work in PHP 4.X
I am having problem getting this piece of code to run. The class is
I am having a problem getting this code to work. Basically I Go from
Having a problem with the dataGridView control being populated with Display members: Code: private
Im having a small problem with my code. I have been trying to read
I'm having a problem with getting this code to print out to file due
I'm having a problem with the following code snippet: <!DOCTYPE html> <html> <head> <title>Hangman</title>
I'm having a problem wherein my Python 2.7.3rc2 code runs fine through an IDE
I'm having a problem getting a change event to register with the following code:

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.