跨两个专用网络的网络通信

发布于 2024-08-28 12:18:38 字数 148 浏览 10 评论 0原文

我正在尝试实现点对点通信..

我使用套接字在它们之间进行通信。我想知道当两个对等点位于两个私有网络后面时(他们不知道彼此的公共 IP 地址),是否有任何方法可以使用相同类型的通信。我可以将共享缓冲区视为众所周知的位置一种通讯方式。但是还有其他方法可以完成这个任务吗?

I am trying to implement a peer to peer communication ..

I use sockets for communication between them. I want to know if there are any ways i can use the same sort of communication when the two peers are behind two private Networks (They dont know each others public ip address.) I can think of a shared buffer in a well known location as a means of communication. But is there some other way to get this done?

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

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

发布评论

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

评论(3

断爱 2024-09-04 12:18:38

您可能还必须考虑两个对等点甚至没有公共 IP 地址的情况,在这种情况下您可以使用 STUN 技术以避免对中央服务器的需要。 STUN 已在 Skype 等产品中得到有效使用(我认为),但现阶段它仍然是一种黑魔法。

对于集中方法,请考虑 XMPP,其中 ejabberd 是一个非常流行的实现。还存在各种其他消息传递协议,例如新兴的 AMPQ 标准。

这些技术可能比本地开发的基于套接字的协议更加强大和可扩展。

You may also have to consider the case where two peers don't even have public IP addresses, in which case you could use STUN techniques to avoid the need for a central server. STUN has been used effectively in products such as Skype (I think), but it remains quite a black art at this stage.

For a central approach, consider XMPP, of which ejabberd is a very popular implementation. Various other messaging protocols exist as well, such as the emerging AMPQ standard.

These technologies are likely to be more robust and scalable than a home-grown socket-based protocol.

給妳壹絲溫柔 2024-09-04 12:18:38

正如已经发布的那样,STUN 和 TURN 是实现这一目标的常用方法,并且是基于标准的方法。然而,我最近看到了一种非常有趣的方法来使用 icmp 消息来做到这一点。 它称为 pwnat,可在此处获取

STUN and TURN are the common ways to achieve this as already posted and are standards based approaches. However, I have seen a really interesting approach to doing this using icmp messages recently. It's called pwnat, and available here

简单 2024-09-04 12:18:38

由于两者位于不同的专用网络中,因此双方无法相互通信。
您需要有一个公共服务器,以便您可以通过该服务器建立连接。
有关详细信息,请参阅 resiprocate 、 Resiprocate

Since both are in different private networks, both peers cannot communicate with each other.
You need to have a public server in place, so that you can establish connection via that server.
Refer resiprocate , Resiprocate for details

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