问题描述
根据我在尝试解决这个时的研究问题,事实证明 .Net WebProxy 类不支持 Socks 代理 - 有点烦人.我似乎也找不到任何代码或信息来解释如何通过一个可以轻松与 HttpWebRequest(准确地说是 Proxy 属性)一起使用的类来实现 Socks 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).
我通过谷歌找到了关于如何做到这一点的有限信息.一个建议涉及更改 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.
有没有人知道什么可以做这项工作或有什么建议?任何帮助将不胜感激.
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.
我最终使用了 Chilkat Software 的 Sock/SSL 组件,这似乎有效对我来说很好,即使我必须手动构建 HTTP 请求,而不是像我希望的那样使用 HttpWebRequest.
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 代理.所以不要像我一样花时间尝试编写自己的 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
andChilkat.Http.SocksVersion
properties.
这篇关于用于 HttpWebRequest 的 Socks 代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!