简体   繁体   中英

How can I connect and disconnect from a proxy?

I purchased a premium proxy and they only sent me an IP (51.38.119.210) and a username and password. I need this proxy in a C# project. I need a single-line method that connects me and a method that disconnect.

I googled everywhere and found these codes:

WebRequest request = WebRequest.Create("51.38.119.210");
WebProxy proxy = (WebProxy)WebProxy.GetDefaultProxy();

I have never actually gotten to use Proxies that much in practice, so my knowledge is mostly from Networking Theory.

But I guess it does something like NAT with PortForwarding: Requests reaching it on a Interface and Port Y, always get routed to Interface and Port X (of course the Interface but not the port could be the same). So it is all about setting the Server up with the proper fowarding (or whatever it is called for proxy severs). And then send to it's incomming Port.

Wich is unfortunately a mater of Network/Server Administration and not programming. This also sounds a lot like a homework assignment. For those we do not provide code, only directions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM