如何在.net C#打开插座直通代理服务器? [英] How to open socket thru proxy server in .Net C#?

查看:139
本文介绍了如何在.net C#打开插座直通代理服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在.net C#打开插座直通代理服务器?

How to open socket thru proxy server in .Net C#?

于是我打开了一个套接字在我机系列。有PE和代理服务器之间没有NATS。我连接到代理服务器。现在,如何使来自全球的IP世界中要求知道代理服务器adrress重定向或代理服务器转移到我吗?

So I opened up a socket on my machin. there are no nats between pe and proxy server. I connected to proxy server. How now to make Requests from global IP world that know that proxy server adrress be redirected or transfered by proxy server to me?

任何库博客文章?请帮忙

Any libs blog articles? Please help

推荐答案

您无法打开一个套接字'直通'的东西,只有'到'的东西。使用代理服务器(我假设你在谈论支持CONNECT命令HTTP代理服务器),这是相同的:首先打开到它的连接,比使用它的协议,使您希望代理转发您连接到使用CONNECT命令

You cannot open a socket 'thru' something, only 'to' something. With proxy server (I assume you're talking about HTTP proxy that support 'CONNECT' command) it's the same: first open a connection to it, than use its protocol to make proxy forward your connection where you want to using 'CONNECT' command.

所以,你需要做以下步骤:

So you need to do the following steps:

  1. 连接到代理服务器。
  2. 问题连接主机:端口的HTTP / 1.1< CR>< LF>
  3. 问题< CR>< LF>
  4. 在等待响应线。如果它包含 HTTP / 1.X 200 ,连接成功。
  5. ,直到收到一个空行进一步阅读行响应。
  6. 现在,通过一个代理连接到外部世界。你想要的任何数据交换。
  1. Connect to proxy.
  2. Issue CONNECT Host:Port HTTP/1.1<CR><LF>
  3. Issue <CR><LF>
  4. Wait for a line of response. If it contains HTTP/1.X 200, the connection is successful.
  5. Read further lines of response until you receive an empty line.
  6. Now, you are connected to the outside world through a proxy. Do any data exchange you want.

这篇关于如何在.net C#打开插座直通代理服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆