Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It turned out wait for a connection to the HTTP-server 'www.google.com' #121

Open
imrroot opened this issue Feb 28, 2021 · 7 comments
Open
Labels
insufficient info There is not enough information about the issue.

Comments

@imrroot
Copy link

imrroot commented Feb 28, 2021

hi im trying to send get or post request with ThreadPool But its show this error always

Error Code = Exception thrown: 'Leaf.xNet.HttpException' in Leaf.xNet.dll ("It turned out wait for a connection to the HTTP-server 'www.google.com'.")

and this is my code

var source;
var userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36";
try{
using (var request = new HttpRequest()
{
IgnoreProtocolErrors = true,
KeepAlive = true,
AllowAutoRedirect = true,
UserAgent = userAgent,
}.AddHeader(HttpHeader.Accept, "text/plain, /"))
{
response = request.Get("https://www.google.com/");
source = response.ToString();
}
}

catch (HttpException)
{
lblerror.Text = (int.Parse(lblerror.Text) + 1).ToString();
}

what is problem ? by the way its work with default thread but with ThreadPool has problem

@imrroot
Copy link
Author

imrroot commented Mar 23, 2021

please answer

@biitez
Copy link

biitez commented Apr 21, 2021

By pure chance, are you using proxies?, try to place a timeout in the HttpRequest configuration, as here https://share.biitez.dev/i/rp7aj.png

@imrroot
Copy link
Author

imrroot commented Apr 22, 2021

By pure chance, are you using proxies?, try to place a timeout in the HttpRequest configuration, as here https://share.biitez.dev/i/rp7aj.png

i dont use proxies i told its work with 1 thread but with threadpool throw this error

@grandsilence grandsilence added the insufficient info There is not enough information about the issue. label Jul 2, 2021
@YazzyTales
Copy link

YazzyTales commented Feb 16, 2022

I have the same Problem. If I use a Threadpool.SetMinThreads and Threadpool.SetMaxThreads I get the same error. Once removed everything works. I dont understand why this happens.
So the issue simply comes once Threadpool.SetMinThreads is set for some reason

Anyone knows any fix to this? Since I wanna set Threadpool MinThreads but I cant do it using it together with Leaf.xNet..

@grandsilence grandsilence reopened this Feb 16, 2022
@abhay991
Copy link

I have the same Problem. If I use a Threadpool.SetMinThreads and Threadpool.SetMaxThreads I get the same error. Once removed everything works. I dont understand why this happens. So the issue simply comes once Threadpool.SetMinThreads is set for some reason

Anyone knows any fix to this? Since I wanna set Threadpool MinThreads but I cant do it using it together with Leaf.xNet..

Try using only Threadpool.SetMinThreads & do not set Threadpool.SetMaxThreads. If you are using Parallel.For or Foreach then pass ParallelOptions with Maxdegreeofparallelism as threads count

@ductai230894
Copy link

Same problem, use threadpool allways raise this exception.
I use task with option long running, and work perfectly.

@imrroot
Copy link
Author

imrroot commented Jan 18, 2023

Same problem, use threadpool allways raise this exception.
I use task with option long running, and work perfectly.

Hi my problem fixed after adding timeout parameter thread pool worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
insufficient info There is not enough information about the issue.
Projects
None yet
Development

No branches or pull requests

6 participants