如何在 .Net C# 中通过代理服务器打开套接字? [英] How to open socket thru proxy server in .Net C#?

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

问题描述

如何在 .Net C# 中通过代理服务器打开套接字?

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

所以我在我的机器上打开了一个插座.pe 和代理服务器之间没有 nats.我连接到代理服务器.现在如何使来自知道代理服务器地址的全球 IP 世界的请求被代理服务器重定向或传输给我?

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?

任何 libs 博客文章?请帮忙

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 supports 'CONNECT' command) it's the same: first open a connection to it, then 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. 问题 CONNECT Host:Port HTTP/1.1
  3. 问题
  4. 等待一行响应.如果包含HTTP/1.X 200,则连接成功.
  5. 阅读更多的回复行,直到收到空行.
  6. 现在,您通过代理连接到外部世界.进行任何您想要的数据交换.

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

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