套接字和TCP冲孔 [英] Socket And TCP Hole Punching

查看:94
本文介绍了套接字和TCP冲孔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我开始了解跨网络地址转换器(NAT)的对等(P2P)通信".首先,我必须执行称为打孔"的方法.但是我不知道如何以代码开头(例如任何示例或示例代码开始).我正在使用TCP套接字,因此我需要"TCP打孔"来实现.

谢谢.
请帮助

Hi I came to know about "Peer-to-Peer (P2P) Communication across Network Address Translators (NATs)". The first i have to do the method called "Hole Punching". But i have no idea how to start with code (e.g. any example or sample code to start). I am using TCP socket so i need "TCP Hole Punching" to implement.

Thanks.
Please help

推荐答案

您可以随时尝试
You could always try this[^].


打孔"与任何NAT路由器一样都是误称值得其名称的将丢弃或忽略它不知道的任何连接请求.

因此,所需要的是同时存在于NAT路由器后面的两个网络之外的服务器,该服务器接受来自NAT路由器后面的客户端的连接请求,并处理所述客户端之间的信息路由.

现在有例外,中央服务器将NAT路由器之间的IP地址通知给NAT路由器后面的客户端"和服务器",并尝试直接连接,但是默认连接是通过NAT后面网络外部的中央服务器进行的路由器.
"Hole Punching" is a misnomer as any NAT router worthy of its name will drop or ignore any connection request that it does not know about.

So what is required is a server that exists outside of both the networks that exist behind the NAT routers, this server accepts connection requests from the clients behind the NAT routers and handles the routing of information between said clients.

Now there are exceptions where the central server notifies the "clients" and "servers" behind the NAT routers of the IP addresses of each other and a direct connection is attempted but the default connection is through a central server outside of the networks behind the NAT routers.


这篇关于套接字和TCP冲孔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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