SocksSharp | SocksSharp provides support for Socks4/4a/5 proxy servers | Proxy library
kandi X-RAY | SocksSharp Summary
kandi X-RAY | SocksSharp Summary
SocksSharp provides support for Socks4/4a/5 proxy servers to HttpClient.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SocksSharp
SocksSharp Key Features
SocksSharp Examples and Code Snippets
Community Discussions
Trending Discussions on SocksSharp
QUESTION
I need to create a multithreaded application which makes requests (Post, get etc)
For this purpose i chose Httpclient
.
By default it does not support Socks proxies. So I find Sockshandler
(https://github.com/extremecodetv/SocksSharp) can be used instead of basic HttpClientHandler. It allows me to use socks.
But I have a problem. All my requests should be send through different proxies which I have parsed from the internet. But httpclient handler doesn't support changing proxies dynamically. If I don't have valid proxy, I need to recreate a httclient, this is ok, but if I have 200 threads, it takes a lot of cpu. So what should I do in this situation?
And second problem. I found this article (https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/) which talks to use HttpClient
as a single instance to better performance, but it's impossible in multithreaded program. Which way is better in this case?
Thx for help
...ANSWER
Answered 2019-Apr-19 at 12:14httpclient handler doesn't support changing proxies dynamically.
I'm not sure if that's technically true. Proxy is a read/write property so I believe you could change it (unless that results in a runtime error...I haven't actually tried it to be honest).
UPDATE: I have tried it now and your assertion is technically true. In the sample below, the line that updates UseProxy
will fail with "System.InvalidOperationException: 'This instance has already started one or more requests. Properties can only be modified before sending the first request.'" Confirmed on .NET Core and full framework.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SocksSharp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page