0

So I was wondering if it's possible to use proxies with

System.Net.Sockets;

I've searched extensively however most of the posts regarding this question are years old and outdated in terms of the answer.. I did find some form of solutions, however they weren't very explanatory. In basic terms I want the equivalent of

//used for HttpWebRequest, WebClient & HttpClient

WebProxy myproxy = new WebProxy(proxy, port);

for Sockets, I found this library > https://www.example-code.com/csharp/socket_http_proxy.asp.. However I'm looking to see if there's other alternatives ( Socks proxy can be used over http proxies, it's not a mandatory factor )

InfoSec
  • 29
  • 6
  • Possible duplicate of [How to open socket thru proxy server in .Net C#?](https://stackoverflow.com/questions/3127127/how-to-open-socket-thru-proxy-server-in-net-c) – NibblyPig Mar 22 '19 at 09:57
  • A socket is used to send/receive IP messages. A message consists of different layer like IP Header layer , then UDP, TCP Header layer , and then data layer. The Net Library limits access to some message type in c# because only some IP types are defined in the Net Library. c++ using pointers can add the missing types. So any IP Protocol can be developed using the Net Library Sockets. In some cases you need to use c++ due to the managed c# library not defining all properties of IP. – jdweng Mar 22 '19 at 10:19

1 Answers1

0

As described in this answer, which I found in this question, it's not possible to connect THRU a proxy, since you have to connect TO the proxy. It's the proxy's work to connect TO the desired target.

If you want to do this using C# you could create two applications. One for the client and one for the proxy. The client connects TO the proxy, and the proxy connects TO the desired socket/target. So, the client connects "thru" the proxy TO the target.

Marvin Klar
  • 1,869
  • 3
  • 14
  • 32