Socks代理的HttpWebRequest的Socks、HttpWebRequest

2023-09-03 02:34:36 作者:多余者

根据我的研究,同时试图解决this问题,事实证明,在净WebProxy类不支持SOCKS代理 - 一点点讨厌。我也似乎无法找到任何code或信息,这也解释了如何通过它可以很容易地与HttpWebRequest的使用(在Proxy属性,是精确的)一个类实现袜子4/5支持。

According to my research whilst trying to solve this problem, it turns out that the .Net WebProxy class does not support Socks proxies - a tad annoying. I also can't seem to find any code or information which explains how to implement Socks 4/5 support via a class which can easily be used with HttpWebRequest (the Proxy property, to be exact).

我发现通过谷歌,我怎么能做到这一点有限的信息。 One建议涉及更改Internet Explorer代理设置 - 这一点我宁愿不做

I've found limited information via google on how I could do this. One suggestion involves changing internet explorer proxy settings - something I'd rather not do.

有谁知道的任何事情,可以做的工作,或有什么建议?任何帮助将是非常美联社preciated。

Does anyone know of anything which could do the job or have any suggestions? Any help would be much appreciated.

推荐答案

我想它声称支持的Socks4 / 5,但发现很多人只是没有工作或将错误尝试连接到代理服务器,我知道是无数的.NET库运作。

I tried numerous .Net libraries which claimed to support Socks4/5 but found many of them just did not work or would error trying to connect to proxies I knew were functioning.

我一直使用奇尔卡特软件的袜子/ SSL组件这似乎工作结束很适合我,即使我不得不手动构建使用HttpWebRequest的,因为我本来希望的HTTP请求来代替。

I've ended up using Chilkat Software's Sock/SSL component which seems to work well for me even if I do have to manually construct the HTTP requests instead of using HttpWebRequest as I would have liked.

更新注:Chilkat.Http(类似于HttpWebRequest类)本身是否有SOCKS代理支持。所以不要花时间去code自己的HTTP请求和我一样;只需使用 Chilkat.Http.SocksHostname Chilkat.Http.SocksPort Chilkat.Http .SocksVersion 属性。 Update note: Chilkat.Http (similar to the HttpWebRequest class) does inherently have support for SOCKS proxies. So don't spend time trying to code your own HTTP requests as I did; just use the Chilkat.Http.SocksHostname, Chilkat.Http.SocksPort and Chilkat.Http.SocksVersion properties.