Socksifying Java ServerSocket - 如何实现

发布于 2024-09-04 17:07:21 字数 296 浏览 3 评论 0原文

我想让一个在网络 A 上运行的 Java 程序通过代理在另一个网络 B 上有一个 ServerSocket。我使用过 SOCKS5 代理(可以工作),但似乎 Java 中的所有代理工具都只适用于客户端连接,而不适用于 ServerSockets(没有采用 Proxy 参数的构造函数)。询问谷歌可以得到很多干草和很少的针。

我应该采取什么方法来让它运行?

如果特定客户端比通用 SOCKS 或 Web 代理更好,那就没问题,但它必须是 Java(这就排除了 sshd)。

目标 JVM 最好是 Java 5,然后是 Java 6。

I would like to have a Java program running on network A have a ServerSocket living on another network B through a proxy. I have played with a SOCKS5 proxy (which works) but it appears that all the proxy facilities in Java only work with client connections, not with ServerSockets (no constructor taking a Proxy argument). Asking Google gives much hay and few needles.

What is the approach I should take to get this running?

If a specific client is better than a generic SOCKS or web proxy then fine, but it needs to be Java (that leaves sshd out).

Target JVM is preferrably Java 5, and then Java 6.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

树深时见影 2024-09-11 17:07:21

为什么不直接设置一个 stunnel 来处理转发来自一个网络到另一个网络?正如 ZZ Coder 提到的,这不是服务器问题,因此解决方案应该位于 Java 应用程序代码库之外(恕我直言)。

Why not just set up an stunnel to deal with forwarding the traffic from one network to the other? As ZZ Coder mentions this isn't a server issue and so the solution should live outside your Java application codebase IMHO.

街角卖回忆 2024-09-11 17:07:21

代理是客户端问题,服务器不应该关心。例如,网络 B 上的服务器与任何其他服务器没有什么不同。客户端和代理负责从其他网络建立与其的连接。

在服务器端,您可能唯一关心的是找出客户端的原始IP地址。到服务器,连接来自代理。

Proxying is a client issue and server shouldn't care. For example, the server on network B is no different from any other servers. The client and proxy are responsible to make connection to it from other networks.

On server side, the only thing you might care is to find out the original IP address of the client. To server, the connection is from proxy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文