CN1968226A - Method for crossing network address conversion in point-to-point communication - Google Patents
Method for crossing network address conversion in point-to-point communication Download PDFInfo
- Publication number
- CN1968226A CN1968226A CN 200610076880 CN200610076880A CN1968226A CN 1968226 A CN1968226 A CN 1968226A CN 200610076880 CN200610076880 CN 200610076880 CN 200610076880 A CN200610076880 A CN 200610076880A CN 1968226 A CN1968226 A CN 1968226A
- Authority
- CN
- China
- Prior art keywords
- address
- receiving terminal
- originating end
- port pair
- point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
- Small-Scale Networks (AREA)
Abstract
一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤1中发起端将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤2中接收端将收集到的接收端IP地址/端口对及对应的优先级发送给发起端;在步骤3中接收端对邀约消息中的每个发起端IP地址/端口对进行连接检查;发起端对回应消息中包括的每个接收端IP地址/端口对进行连接检查;在步骤4中接收端对邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查;发起端对回应消息中的STUN服务器分配的接收端IP地址/端口对进行连接检查。本发明能够降低TURN服务器的负担和带宽需求,且不需分析网络拓扑结构。
A method for traversing network address translation in point-to-point communication, comprising the following steps: in step 1, the initiator sends the collected initiator IP address/port pair and the corresponding priority to the receiving end; in step 2, the receiving end sends The collected receiving end IP address/port pair and the corresponding priority are sent to the initiator; in step 3, the receiving end checks the connection of each initiator IP address/port pair in the invitation message; the initiator checks the connection in the response message Each receiver IP address/port pair included in the connection check; in step 4, the receiver checks the connection with the initiator IP address/port pair assigned by the STUN server included in the invitation message; the initiator checks the STUN in the response message The receiving end IP address/port pair assigned by the server is connected to check. The invention can reduce the load and bandwidth requirement of the TURN server without analyzing the network topological structure.
Description
技术领域technical field
本发明涉及一种点对点通信中穿越网络地址转换的方法,特别涉及一种能够降低中继方式穿越网络地址转换的服务器的负担和带宽需求、且不需分析网络拓扑结构的点对点通信中穿越网络地址转换的方法。The present invention relates to a method for traversing network address translation in point-to-point communication, and in particular to a method for traversing network address translation in point-to-point communication that can reduce the burden and bandwidth requirements of a server that traverses network address translation in a relay mode and does not need to analyze network topology method of conversion.
背景技术Background technique
随着基于TCP/IP的互联网的普及,各种规模的局域网被大量组建应用,在这种局域网中,各个网络设备采用局域网的IP地址在局域网注册,连接组成相对独立和封闭的网络,这种网络一般称为私有网络(简称私网)。相对应的,互联网称为公网。私网中的网络设备使用私有IP地址,公网中的网络设备使用公有IP地址。为了使私网中的每个终端都可以访问私网外部的资源,通常在私网和公网之间使用网络地址转换(NETWORK ADDRESSTEANSLATION,简称NAT)来给请求访问公网的内部终端分配一个合法的公网IP地址和端口号,以实现对外部网络的访问。With the popularity of the Internet based on TCP/IP, a large number of LANs of various sizes have been established and applied. In this LAN, each network device uses the IP address of the LAN to register in the LAN, and the connection forms a relatively independent and closed network. The network is generally called a private network (referred to as a private network). Correspondingly, the Internet is called the public network. Network devices on the private network use private IP addresses, and network devices on the public network use public IP addresses. In order to enable each terminal in the private network to access resources outside the private network, Network Address Translation (NETWORK ADDRESSTEANSLATION, NAT for short) is usually used between the private network and the public network to assign a legal The public network IP address and port number to realize access to the external network.
NAT方法包括:NAT methods include:
1、锥型NAT(CONE NAT)。在建立了(私有IP,私有port)和(公有IP,公有port)这个端口绑定之后,锥形NAT对来自同一个私有ip地址和端口的应用程序发起的一系列的会话进行端口重用,只要有一个会话还在,绑定的端口就保留。1. Cone NAT (CONE NAT). After the port binding of (private IP, private port) and (public IP, public port) is established, cone NAT performs port reuse for a series of sessions initiated by applications from the same private ip address and port, as long as As long as there is still a session, the bound port is reserved.
2、完全锥型NAT(FULL CONE NAT)。在为一个向外的会话建立了公/私端口绑定之后,完全锥型NAT随后将接收来自公网上任何终端节点相应端口的输入通讯。完全锥型NAT有时也称为“混杂”(promiscuous)NAT。2. Full cone NAT (FULL CONE NAT). After establishing a public/private port binding for an outgoing session, a full cone NAT will then accept incoming traffic from the corresponding port on any end node on the public network. A full cone NAT is sometimes called a "promiscuous" NAT.
3、限制锥型NAT(RESTRICTED CONE NAT)。限制锥型NAT仅仅在外部输入数据包的端口匹配内部主机曾经发给外部数据时使用的映射端口才转发给内部主机。限制锥型NAT精简采用了防火墙的原则,通过限制输入数据包为已知的外部IP地址,来拒绝一些外部的主动连接请求。3. Restricted cone NAT (RESTRICTED CONE NAT). Restricted cone NAT only forwards to the internal host if the port of the external incoming data packet matches the mapped port used by the internal host to send external data. Restricted Cone NAT uses the principle of firewall to reject some external active connection requests by restricting input data packets to known external IP addresses.
4、端口限制锥型NAT(PORT RESTRICTED CONE NAT)。对于端口限制锥型NAT,如果外部ip地址和端口匹配那些内部主机曾经向外发包在NAT上映射的端口,就将这个输入包转发给相应的内部主机。4. Port restricted cone NAT (PORT RESTRICTED CONE NAT). For port-restricted cone-type NAT, if the external ip address and port match the port mapped on the NAT for those internal hosts to send out packets, the input packet will be forwarded to the corresponding internal host.
5、对称型NAT(SYMMETRIC NAT)。对称NAT在内外网地址端口绑定时并不维护一致的绑定端口,而是给每一个新的会话分配一个新的端口。5. Symmetric NAT (SYMMETRIC NAT). Symmetric NAT does not maintain a consistent binding port when binding internal and external network addresses and ports, but assigns a new port to each new session.
从OSI参考模型的应用层来看,可认为网络是由工作站和服务器组成的,但从传输层和网络层的角度看,工作站和服务器没有本质的区别,它们都是连接到网络上的一台机器,都可以用网络地址或名称来代替。它们之间的通信,就是所谓的点对点通信,也叫对等通信。From the application layer of the OSI reference model, it can be considered that the network is composed of workstations and servers, but from the perspective of the transport layer and network layer, there is no essential difference between workstations and servers, they are all connected to the network. Machine, can be replaced by network address or name. The communication between them is the so-called point-to-point communication, also called peer-to-peer communication.
当前的internet到处都设有NAT设备,这主要是由于IPv4的地址空间耗尽所引起的。然而,由NAT设备建立起来的非对称的连通体系给点对点通信的应用程序和协议(如电信会议和多人在线游戏)带来了独特的问题。当前的NAT设备主要是为了典型的客户端/服务器模型设计的,使匿名客户端来访问有固定IP地址的服务器。许多NAT设备完成了这种非对称连接。私有网络中的主机能够发出一个初始连接到公网主机,但是外部主机不能初始发出对内网主机的连接,除非由NAT设备的管理员配置过了。通常情况下,一个内网的客户端不具有在公网唯一的IP地址,而是和同在一个私有网络中的主机共享一个IP地址,这种共享由NAT设备来维护。这种对内网主机的匿名和不可访问性,对客户端软件比如web浏览器虽不是问题,因为客户端软件仅需要初始向外的连接,然而在点对点通信中,被视为客户端的终端要彼此直接建立连接会话。发起者和回应者也许在不同的NAT设备的后面,可能既没有固定的IP地址,也没有公共网络中其他的存在形式。例如,一个普通的在线游戏体系结构是参与主机来连接已知的服务器来初始化和其他的一些管理动作,主机间建立了直接的连接,以便游戏期间快速有效的更新。类似的,一个文件共享应用程序也是连接已知的服务器进行资源查找,但对数据传送则建立直接的连接。因此NAT设备对点对点通信的影响在于:NAT设备背后的主机没有在公网上永久可用的端口,以和其他的客户建立直接的连接。因此在点对点通信中,需要克服NAT设备造成的影响,实现对NAT设备的穿越,以建立通信连接。The current Internet is equipped with NAT devices everywhere, which is mainly caused by the exhaustion of IPv4 address space. However, the asymmetric connectivity established by NAT devices brings unique problems to point-to-point communication applications and protocols such as teleconferencing and multiplayer online games. Current NAT devices are mainly designed for the typical client/server model, enabling anonymous clients to access servers with fixed IP addresses. Many NAT devices implement this asymmetric connection. Hosts on the private network can initiate an initial connection to hosts on the public network, but external hosts cannot initiate connections to internal hosts unless configured by the administrator of the NAT device. Usually, an intranet client does not have a unique IP address in the public network, but shares an IP address with a host in the same private network, and this sharing is maintained by a NAT device. This kind of anonymity and inaccessibility to intranet hosts is not a problem for client software such as web browsers, because the client software only needs an initial outbound connection. establish connection sessions directly with each other. The initiator and responder may be behind different NAT devices, and may have neither fixed IP addresses nor other forms of existence in the public network. For example, a common online game architecture involves hosts connecting to known servers for initialization and other administrative actions, with direct connections established between hosts for fast and efficient updates during games. Similarly, a file-sharing application also connects to known servers for resource lookups, but establishes direct connections for data transfers. Therefore, the impact of the NAT device on point-to-point communication is that the host behind the NAT device does not have a permanently available port on the public network to establish direct connections with other clients. Therefore, in point-to-point communication, it is necessary to overcome the influence caused by the NAT device and realize the traversal of the NAT device to establish a communication connection.
现有技术中,为实现上述目的,通常采用以下方法:In the prior art, in order to achieve the above purpose, the following methods are usually adopted:
1、UDP穿孔(UDP HOLE PUNCHING)方法。1. UDP HOLE PUNCHING method.
该方法是从NAT设备所在的私网内的终端向外部网络中的终端发送UDP数据包,该数据包经过NAT设备时NAT设备保存其映射关系,以使从该外部网络中的终端发送的数据包能够通过该映射关系穿越该NAT设备,到达该私网内的终端。由于NAT设备的处理流程是非标准化的,因此该方法并不能应用于所有类型的NAT,只适用于锥型NAT、完全锥型NAT、限制锥型NAT、以及端口限制锥型NAT。The method is to send a UDP data packet from a terminal in the private network where the NAT device is located to a terminal in the external network. When the data packet passes through the NAT device, the NAT device saves its mapping relationship so that the data sent from the terminal in the external network The packet can pass through the NAT device through the mapping relationship and reach the terminal in the private network. Since the processing flow of the NAT device is not standardized, this method cannot be applied to all types of NAT, and is only applicable to cone NAT, full cone NAT, restricted cone NAT, and port restricted cone NAT.
该方法的不足之处在于:必须分析点对点通信两端所在的网络的拓扑结构,针对不同的拓扑结构采取不同的处理步骤。The disadvantage of this method is that it is necessary to analyze the topological structure of the network where the two ends of the point-to-point communication are located, and take different processing steps for different topological structures.
2、交互式连接建立(INTERACTIVE CONNECTIVITY ESTABLISHMENT,简称ICE)方法。2. Interactive connection establishment (INTERACTIVE CONNECTIVITY ESTABLISHMENT, ICE for short) method.
ICE定义的是一种标准化的方法,使点对点通信的两端能够确定两端之间存在的是哪一种类型的NAT设备,并且确定一连串可以用于实现连接的IP地址。通过使用多种协议及网络连接机制,如UDP简单穿越网络地址转换(SIMPLE TRAVERSAL OF USER DATAGRAM PROTOCOL ADDRESS TRANSLATION,简称STUN)机制、以及中继方式穿越网络地址转换(Traversal Using RelayNAT,简称TURN)机制,ICE可以学习客户端所在网络的拓扑结构以及这些设备可以实现通信的各类网络地址,当一个具备ICE功能的客户端(发起端)希望与另外一台客户端(接收端)通信时,它首先会从STUN、TURN等来源中收集尽可能多的IP地址信息,并在本地对那些地址进行配置,选择其中可以向客户端提供IP流量的地址。ICE的一项关键优势就是能够统一这些IP地址信息源提供的信息,并创建尽可能多的路径来连接自己的目的地。此时,发起的客户端通过这些地址连接至一台STUN服务器,并向所需要的接收端客户机发送一条启动信息。这条信息中包含先前学习到的所有可能的地址组合,并利用它们到达自己的目的地。当接收端收到启动信息后,它会通过这些地址向发起端发送一系列的STUN请求。通常情况下,由于沿途网络拓扑结构和NAT防火墙的缘故,接收端发出的STUN请求中至少会有一条到达发起端。当发起端接收到这些STUN请求后,它会逐条进行回复。如果一部分STUN请求能够穿透并抵达接收端,那么就表明发起端和接收端之间可以利用这部分地址进行通信。在此基础上,发起端和接收端还会利用启动信息中排序最高的那部分地址进行进一步的点对点通信。What ICE defines is a standardized method that enables the two ends of a point-to-point communication to determine which type of NAT device exists between the two ends, and to determine a series of IP addresses that can be used to implement the connection. By using a variety of protocols and network connection mechanisms, such as UDP simple traversal of network address translation (SIMPLE TRAVERSAL OF USER DATAGRAM PROTOCOL ADDRESS TRANSLATION, referred to as STUN) mechanism, and relay mode traversal of network address translation (Traversal Using RelayNAT, referred to as TURN) mechanism, ICE can learn the topology of the network where the client is located and the various network addresses that these devices can communicate with. When a client (initiator) with ICE function wants to communicate with another client (receiver), it first It collects as much IP address information as possible from sources such as STUN, TURN, etc., configures those addresses locally, and selects the addresses that can provide IP traffic to the client. A key strength of ICE is its ability to unify the information provided by these sources of IP address information and create as many paths as possible to connect to its own destination. At this point, the initiating client connects to a STUN server through these addresses, and sends a start message to the desired receiving client. This message contains all the possible address combinations it has previously learned, and uses them to reach its destination. When the receiving end receives the start information, it will send a series of STUN requests to the originating end through these addresses. Usually, due to the topology of the network along the route and the NAT firewall, at least one of the STUN requests sent by the receiver will reach the initiator. When the initiator receives these STUN requests, it will reply one by one. If a part of the STUN request can penetrate and reach the receiving end, it means that the initiator and the receiving end can use this part of the address for communication. On this basis, the originating end and the receiving end will also use the highest-ranked part of the address in the activation information for further point-to-point communication.
参见图1所示的ICE方法流程图,包括以下步骤:首先发起端收集TURN/STUN服务器(同时设有TURN服务器和STUN服务器的服务器)分配给该发起端的所有IP地址/端口对及相应优先级,其中,以本地IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低;然后发起端将这些IP地址/端口对和相应的优先级以邀约消息的方式发送给接收端;接收端收到邀约消息后,收集所述TURN/STUN服务器分配给该接收端的所有IP地址/端口对及相应的优先级,然后将这些IP地址/端口对和相应优先级以回应消息的方式发送给所述发起端;继而接收端对所述邀约消息中的每个IP地址/端口对,检查其是否能够连接到所述发起端,并选取其中能够连接到所述发起端且优先级最高的IP地址/端口对,作为与所述发起端建立点对点通信连接的IP地址/端口对;而所述发起端也对所述回应消息中的每个IP地址/端口对,检查其是否能够连接到所述接收端,并选取其中能够连接到所述接收端且优先级最高的IP地址/端口对,作为与所述接收端建立点对点通信连接的IP地址/端口对。Referring to the flow chart of the ICE method shown in Figure 1, it includes the following steps: first, the initiator collects all IP addresses/port pairs and corresponding priorities assigned to the initiator by the TURN/STUN server (a server that is provided with a TURN server and a STUN server at the same time) , among them, the local IP address/port pair has the highest priority, the IP address/port pair assigned by the STUN server has the second priority, and the IP address/port pair assigned by the TURN server has the lowest priority; then the initiator sends these IP addresses/ports The pair and the corresponding priority are sent to the receiving end in the form of an invitation message; after receiving the invitation message, the receiving end collects all IP address/port pairs and corresponding priority assigned to the receiving end by the TURN/STUN server, and then sends These IP address/port pairs and corresponding priorities are sent to the initiator in the form of a response message; then the receiving end checks whether it can connect to the initiator for each IP address/port pair in the invitation message , and select the IP address/port pair that can be connected to the initiator and has the highest priority as the IP address/port pair that establishes a point-to-point communication connection with the initiator; and the initiator also responds to the response message For each IP address/port pair in , check whether it can connect to the receiving end, and select the IP address/port pair that can be connected to the receiving end and has the highest priority as the point-to-point connection with the receiving end The IP address/port pair for the communication connection.
该方法的不足之处在于:如果发起端处于限制锥型NAT设备或端口限制锥型NAT设备后,接收端检查所述邀约消息中的IP地址/端口对后,可能选取TUREN服务器为发起端分配的IP地址/端口对,作为与发起端建立点对点通信连接的IP地址/端口对,从而增加了TURN服务器的负担和带宽需求。The disadvantage of this method is that if the initiator is behind a restricted cone NAT device or a port restricted cone NAT device, after the receiving end checks the IP address/port pair in the invitation message, it may select a TUREN server to assign the originating end The IP address/port pair used as the IP address/port pair for establishing a point-to-point communication connection with the initiator, thus increasing the burden and bandwidth requirements of the TURN server.
发明内容Contents of the invention
本发明的目的是针对上述现有技术的不足,提供一种点对点通信中穿越网络地址转换的方法,对于限制锥型NAT设备或端口限制锥型NAT设备,能够减轻TURN服务器的负担和带宽需求,且不需分析网络拓扑结构。The purpose of the present invention is to address the deficiencies of the above-mentioned prior art, and provide a method for traversing network address translation in point-to-point communication, which can reduce the burden and bandwidth requirements of the TURN server for restricted cone NAT devices or port restricted cone NAT devices, And there is no need to analyze the network topology.
为实现上述目的,本发明提供了一种点对点通信中穿越网络地址转换的方法,包括以下步骤:In order to achieve the above object, the present invention provides a method for traversing network address translation in point-to-point communication, comprising the following steps:
步骤1、发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低;
步骤2、所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低;
步骤3、所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的IP地址/端口对,作为第一发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第一接收端IP地址/端口对;
步骤4、所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对。上述步骤4中所述接收端的操作和所述发起端的操作是相互独立地进行,即可同时进行,也可先后进行,且先后次序可调换。
进一步地,所述步骤4可具体包括以下步骤:在步骤40中,所述接收端判断所述第一发起端IP地址/端口对是否为TURN服务器分配的IP地址/端口对,是则执行步骤41,否则执行步骤42;在步骤41中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤43;在步骤42中,所述接收端将所述第一发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;在步骤43中,所述发起端判断所述第一接收端IP地址/端口对是否为TURN服务器分配的接收端IP地址/端口对,是则执行步骤44,否则执行步骤45;在步骤44中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束;在步骤45中,所述发起端将所述第一接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。在所述步骤40之前还可包括步骤400,即为:所述接收端判断是否收到所述发起端发送的STUN请求消息,是则执行步骤40,否则继续执行步骤400。所述步骤41可具体包括以下步骤:在步骤410中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述发起端的发起端IP地址/端口对,是则执行步骤411,否则执行步骤42;在步骤411中,所述接收端选取所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤43。在所述步骤44之前还可包括步骤430,即为:所述发起端判断是否收到所述接收端发送的STUN请求消息,是则执行步骤44,否则继续执行步骤430。所述步骤44可具体包括以下步骤:在步骤440中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述接收端的接收端IP地址/端口对,是则执行步骤441,否则执行步骤45;在步骤441中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。Further, the step 4 may specifically include the following steps: In step 40, the receiving end judges whether the IP address/port pair of the first initiator is the IP address/port pair assigned by the TURN server, and if so, execute the step 41, otherwise step 42 is performed; in step 41, the receiving end performs a connection check on the originating end IP address/port pair allocated by the STUN server included in the invitation message, and selects which can be connected to the originating end and has priority The initiator IP address/port pair with the highest level is used as the second initiator IP address/port pair, and the second initiator IP address/port pair is used as the initiator IP address for establishing a point-to-point communication connection with the initiator /port pair, and then perform step 43; in step 42, the receiving end uses the first initiator IP address/port pair as the initiator IP address/port pair to establish a point-to-point communication connection with the initiator; In step 43, the initiator judges whether the first receiving end IP address/port pair is the receiving end IP address/port pair allocated by the TURN server, if yes, execute step 44, otherwise execute step 45; in step 44, The initiator performs a connection check on the receiving end IP address/port pair assigned by the STUN server included in the response message, and selects the receiving end IP address/port pair that can be connected to the receiving end and has the highest priority as The second receiving end IP address/port pair, and using the second receiving end IP address/port pair as the receiving end IP address/port pair to establish a point-to-point communication connection with the receiving end, and then end; in step 45, The initiating end uses the first receiving end IP address/port pair as the receiving end IP address/port pair for establishing a point-to-point communication connection with the receiving end, and then ends. Step 400 may also be included before
进一步地,所述步骤4可具体包括以下步骤:在步骤40′中,所述发起端判断所述第一接收端IP地址/端口对是否为TURN服务器分配的接收端IP地址/端口对,是则执行步骤41′,否则执行步骤42′;在步骤41′中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤43′;在步骤42′中,所述发起端将所述第一接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对;在步骤43′中,所述接收端判断所述第一发起端IP地址/端口对是否为TURN服务器分配的发起端IP地址/端口对,是则执行步骤44′,否则执行步骤45′;在步骤44′中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束;在步骤45′中,所述接收端将所述第一发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。在所述步骤40′之前还可包括步骤400′,即为:所述发起端判断是否收到所述接收端发送的STUN请求消息,是则执行步骤40′,否则继续执行步骤400′。所述步骤41′可具体包括以下步骤:在步骤410′中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述接收端的接收端IP地址/端口对,是则执行步骤411′,否则执行步骤42′;在步骤411′中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤43′。在所述步骤44′之前还可包括:步骤430′,即为:所述接收端判断是否收到所述发起端发送的STUN请求消息,是则执行步骤44′,否则继续执行步骤430′。所述步骤44′可具体包括以下步骤:在步骤440′中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述发起端的发起端IP地址/端口对,是则执行步骤441′,否则执行步骤45′;在步骤441′中,所述接收端选取所述邀约消息中包括的STUN服务器分配的IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。Further, the step 4 may specifically include the following steps: In step 40', the initiator judges whether the IP address/port pair of the first receiving end is the IP address/port pair of the receiving end allocated by the TURN server, yes Then execute step 41', otherwise execute step 42'; in step 41', the initiator IP address/port pair of the receiving end assigned by the STUN server included in the response message is checked for connection, and it is selected to connect to The receiving end and the receiving end IP address/port pair with the highest priority are used as the second receiving end IP address/port pair, and the second receiving end IP address/port pair is used as the point-to-point communication with the receiving end connected receiving end IP address/port pair, and then perform step 43'; in step 42', the initiator uses the first receiving end IP address/port pair as the receiving end for establishing a point-to-point communication connection with the receiving end terminal IP address/port pair; in step 43', the receiving end judges whether the first initiator IP address/port pair is the initiator IP address/port pair allocated by the TURN server, and if so, executes step 44', Otherwise, execute step 45'; in step 44', the receiving end performs a connection check on the initiator IP address/port pair allocated by the STUN server included in the invitation message, and selects which can be connected to the initiator and has priority The initiator IP address/port pair with the highest level is used as the second initiator IP address/port pair, and the second initiator IP address/port pair is used as the initiator IP address for establishing a point-to-point communication connection with the initiator /port pair, and then end; in step 45', the receiving end uses the first initiator IP address/port pair as the initiator IP address/port pair to establish a point-to-point communication connection with the initiator, and then ends . Step 400' may also be included before step 40', that is: the initiator judges whether the STUN request message sent by the receiver is received, and if yes, execute step 40'; otherwise, continue to execute step 400'. The step 41' may specifically include the following steps: In step 410', the initiator performs a connection check on the receiving end IP address/port pair allocated by the STUN server included in the response message, and checks whether it includes To the receiving end IP address/port pair of the receiving end, if yes, execute step 411', otherwise execute step 42'; in step 411', the initiator selects the receiving end assigned by the STUN server included in the response message Among the IP address/port pairs, the IP address/port pair with the highest priority that can be connected to the receiving end is used as the second receiving end IP address/port pair, and the second receiving end IP address/port For the IP address/port pair of the receiving end that establishes a point-to-point communication connection with the receiving end, then step 43' is performed. Before the step 44', it may further include: a step 430', namely: the receiving end judges whether the STUN request message sent by the initiating end is received, and if yes, execute the step 44'; otherwise, continue to execute the step 430'. The step 44' may specifically include the following steps: In step 440', the receiving end performs a connection check on the initiator IP address/port pair allocated by the STUN server included in the invitation message, and checks whether it includes an IP address/port pair that can be connected To the initiator IP address/port pair of the initiator, if yes, execute step 441', otherwise execute step 45'; in step 441', the receiver selects the IP address assigned by the STUN server included in the invitation message The IP address/port pair that can be connected to the initiator and has the highest priority in the /port pair is used as the second initiator IP address/port pair, and the second initiator IP address/port pair is used as the The IP address/port pair of the originator that establishes a point-to-point communication connection with the originator, and then ends.
为实现发明目的,本发明还提供了另外一种点对点通信中穿越网络地址转换的方法,包括以下步骤:To achieve the purpose of the invention, the present invention also provides another method for traversing network address translation in point-to-point communication, comprising the following steps:
步骤A1、发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低;Step A1, the initiator collects all initiator IP address/port pairs including the IP address/port pair assigned to the initiator by the STUN/TURN server, and the priority corresponding to each initiator IP address/port pair, and then passes The invitation message sends the collected initiator IP address/port pair and the corresponding priority to the receiving end. Among them, the initiator's local IP address/port pair has the highest priority, and the IP address/port pair assigned by the STUN server has the second priority. In short, the IP address/port pair assigned by the TURN server has the lowest priority;
步骤A2、所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第三发起端IP地址/端口对;Step A2, the receiving end performs a connection check on the initiator IP address/port pair assigned by the STUN server included in the invitation message, and selects the initiator IP address/port with the highest priority that can connect to the initiator Yes, as the third initiator IP address/port pair;
步骤A3、所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低;Step A3, the receiving end collects all receiving end IP address/port pairs including the IP address/port pair assigned to the receiving end by the STUN/TURN server, and the priority corresponding to each receiving end IP address/port pair, Then send the collected receiving end IP address/port pair and corresponding priority to the initiator through a response message, wherein the local IP address/port pair of the receiving end has the highest priority, and the IP address/port assigned by the STUN server The priority is second, and the IP address/port pair assigned by the TURN server has the lowest priority;
步骤A4、所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第三接收端IP地址/端口对;Step A4, the initiator performs a connection check on the receiving end IP address/port pair assigned by the STUN server included in the response message, and selects the receiving end IP address/port that can connect to the receiving end and has the highest priority Yes, as the third receiver IP address/port pair;
步骤A5、所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的IP地址/端口对;所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的IP地址/端口对。Step A5, the receiving end uses the third initiating end IP address/port pair as the IP address/port pair for establishing a point-to-point communication connection with the initiating end; the initiating end uses the third receiving end IP address/port pair The port pair serves as an IP address/port pair for establishing a point-to-point communication connection with the receiving end.
进一步地,步骤A2中所述的接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查可具体包括:所述接收端将所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对作为目的IP地址/端口对,并向该目的IP地址/端口对发送UDP消息。步骤A4中所述的发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查可具体包括:所述发起端将所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对作为目的IP地址/端口对,并向该目的IP地址/端口对发送UDP消息。Further, the receiving end described in step A2 performing a connection check on the IP address/port pair of the initiator assigned by the STUN server included in the invitation message may specifically include: the receiving end sends the STUN included in the invitation message to The initiator IP address/port pair assigned by the server is used as the destination IP address/port pair, and a UDP message is sent to the destination IP address/port pair. The initiator described in step A4 performing a connection check on the receiving end IP address/port pair assigned by the STUN server included in the response message may specifically include: the initiator assigning the IP address/port pair included in the response message to the STUN server. The receiving end IP address/port pair is used as the destination IP address/port pair, and a UDP message is sent to the destination IP address/port pair.
在所述步骤A4与步骤A5之间还可包括步骤A401,即为:所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第四发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第四接收端IP地址/端口对。所述步骤A2可具体包括以下步骤:在步骤A20中,所述接收端检查所述邀约消息中是否包括STUN服务器分配的发起端IP地址/端口对,是则执行步骤A21,否则执行步骤A3;在步骤A21中,所述接收端选取所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第三发起端IP地址/端口对。所述步骤A4可具体包括以下步骤:在步骤A40中,所述发起端检查所述回应消息中是否包括STUN服务器分配的接收端IP地址/端口对,是则执行步骤A41,否则执行步骤A401;在步骤A41中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第三接收端IP地址/端口对,然后执行步骤A5。Step A401 may also be included between step A4 and step A5, that is: the receiving end performs a connection check on each originating end IP address/port pair included in the invitation message, and selects the IP address/port pair that can be connected to the The initiator IP address/port pair with the highest priority as the fourth initiator IP address/port pair; the initiator connects to each receiver IP address/port pair included in the response message Checking, selecting the IP address/port pair of the receiving end that can be connected to the receiving end and has the highest priority as the fourth receiving end IP address/port pair. The step A2 may specifically include the following steps: In step A20, the receiving end checks whether the invitation message includes the initiator IP address/port pair assigned by the STUN server, if yes, execute step A21, otherwise execute step A3; In step A21, the receiving end selects the initiator IP address/port pair assigned by the STUN server included in the invitation message, which can be connected to the initiator and has the highest priority IP address/port pair, As the third initiator IP address/port pair. The step A4 may specifically include the following steps: In step A40, the initiator checks whether the response message includes the receiving end IP address/port pair allocated by the STUN server, if yes, execute step A41, otherwise execute step A401; In step A41, the initiator selects the IP address/port pair of the receiving end assigned by the STUN server included in the response message, which can be connected to the receiving end and has the highest priority IP address/port pair, As the third receiver IP address/port pair, then perform step A5.
进一步地,所述步骤A5可具体包括以下步骤:在步骤A50中,所述接收端判断是否已选取所述第三发起端IP地址/端口对,是则执行步骤A51,否则执行步骤A52;在步骤A51中,所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤A53;在步骤A52中,所述接收端将所述第四发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;在步骤A53中,所述发起端判断是否已选取所述第三接收端IP地址/端口对,是则执行步骤A54,否则执行步骤A55;在步骤A54中,所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束;在步骤A55中,所述发起端将所述第四接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。所述步骤A5也可具体包括以下步骤:在步骤A50′中,所述发起端判断是否已选取所述第三接收端IP地址/端口对,是则执行步骤A51′,否则执行步骤A52′;在步骤A51′中,所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤A53′;在步骤A52′中,所述发起端将所述第四接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对;在步骤A53′中,所述接收端判断是否已选取所述第三发起端IP地址/端口对,是则执行步骤A54′,否则执行步骤A55′;在步骤A54′中,所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束;在步骤A55′中,所述接收端将所述第四发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。Further, the step A5 may specifically include the following steps: In step A50, the receiving end judges whether the IP address/port pair of the third initiator has been selected, if yes, execute step A51, otherwise execute step A52; In step A51, the receiving end uses the third initiator IP address/port pair as the initiator IP address/port pair for establishing a point-to-point communication connection with the initiator, and then performs step A53; in step A52, the The receiving end uses the fourth initiator IP address/port pair as the initiator IP address/port pair for establishing a point-to-point communication connection with the initiator; in step A53, the initiator determines whether the fourth initiator has been selected Three receiver IP address/port pairs, if yes, execute step A54, otherwise execute step A55; in step A54, the initiator uses the third receiver IP address/port pair as a point-to-point communication with the receiver The receiving end IP address/port pair of connection, end then; In step A55, described initiating end uses described fourth receiving end IP address/port pair as the receiving end IP address/port that establishes point-to-point communication connection with described receiving end port pair, and end. The step A5 may also specifically include the following steps: In step A50', the initiator judges whether the IP address/port pair of the third receiving end has been selected, if yes, execute step A51', otherwise execute step A52'; In step A51', the initiator uses the third receiving end IP address/port pair as the receiving end IP address/port pair for establishing a point-to-point communication connection with the receiving end, and then performs step A53'; in step A52 ', the initiator uses the fourth receiving end IP address/port pair as the receiving end IP address/port pair to establish a point-to-point communication connection with the receiving end; in step A53', the receiving end determines whether The third initiator IP address/port pair has been selected, if yes, execute step A54', otherwise execute step A55'; in step A54', the receiving end uses the third initiator IP address/port pair as Establish the initiator IP address/port pair of the point-to-point communication connection with the initiator, and then end; in step A55', the receiver uses the fourth initiator IP address/port pair as the IP address/port pair established with the initiator The originating IP address/port pair of the point-to-point communication connection, and then ends.
在上述技术方案中,通过在ICE方法中适当地增加对STUN服务器分配的IP地址/端口对进行连接检查,即向STUN服务器分配的IP地址/端口对发送UDP消息的步骤,从而有机地结合了UDP打洞方法和ICE方法,使得ICE方法中必须通过TURN服务器才能连接到对方的通信可不经过TURN服务器而到达对方,从而降低了TURN服务器的负担和带宽需求,并且不需要对网络拓扑进行分析。In the above technical solution, by appropriately adding the IP address/port pair assigned by the STUN server to the connection check in the ICE method, that is, the step of sending a UDP message to the IP address/port pair assigned by the STUN server, thus organically combining The UDP hole-punching method and the ICE method make it possible for the ICE method to connect to the other party through the TURN server. The communication can reach the other party without passing through the TURN server, thereby reducing the burden on the TURN server and bandwidth requirements, and does not need to analyze the network topology.
由上述技术方案可知,本发明有机地结合了点对点通信中穿越NAT的UDP打洞方法和ICE方法,能够达到降低TURN服务器的负担和带宽需求、并且不需要对网络拓扑进行分析的有益效果。It can be seen from the above technical solution that the present invention organically combines the UDP hole punching method and the ICE method for traversing NAT in point-to-point communication, which can achieve the beneficial effect of reducing the burden on the TURN server and bandwidth requirements, and does not need to analyze the network topology.
附图说明Description of drawings
图1为现有技术中点对点通信穿越NAT的ICE方法的流程图;Fig. 1 is the flowchart of the ICE method of point-to-point communication traversing NAT in the prior art;
图2为本发明具体实施例一的联网示意图;Fig. 2 is a schematic diagram of networking in
图3为本发明具体实施例一的流程图;Fig. 3 is the flow chart of
图4为本发明具体实施例二的流程图;Fig. 4 is the flowchart of the second embodiment of the present invention;
图5为本发明具体实施例三的流程图;Fig. 5 is the flowchart of the third embodiment of the present invention;
图6为本发明具体实施例四的流程图;FIG. 6 is a flow chart of
图7为本发明具体实施例五的流程图;Fig. 7 is the flowchart of the fifth embodiment of the present invention;
图8为本发明具体实施例六的流程图。FIG. 8 is a flow chart of Embodiment 6 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例,对本发明的技术方案做进一步的详细描述。The technical solutions of the present invention will be described in further detail below in conjunction with the accompanying drawings and embodiments.
参见图2所示的本发明具体实施例一的联网示意图,TURN/STUN服务器为同时设有TURN服务器端和STUN服务器端的服务器,该服务器位于公网;发起端和接收端分别位于各自所属的私网中,并通过NAT设备连接到公网;发起端设有STUN客户端和TURN客户端,接收端设有STUN客户端和TURN客户端;发起端和接收端均支持ICE方法。参见图3所示的本发明具体实施例一的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤2中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤3中,所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的IP地址/端口对,作为第一发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第一接收端IP地址/端口对;在步骤4中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对。本实施例通过在ICE方法中加入步骤4所述的操作过程,从而能够优选STUN服务器分配的IP地址/端口对,作为建立点对点通信连接的IP地址/端口对,有效地降低了TURN服务器的负荷。Referring to the networking schematic diagram of the first embodiment of the present invention shown in Figure 2, the TURN/STUN server is a server with a TURN server end and a STUN server end at the same time, and the server is located in the public network; network, and connect to the public network through a NAT device; the initiator has a STUN client and a TURN client, and the receiver has a STUN client and a TURN client; both the initiator and receiver support the ICE method. Referring to the flow chart of the first embodiment of the present invention shown in FIG. 3, a method for traversing network address translation in point-to-point communication includes the following steps: In
参见图4所示的本发明具体实施例二的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤2中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤3中,所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的IP地址/端口对,作为第一发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第一接收端IP地址/端口对;在步骤40中,所述接收端判断所述第一发起端IP地址/端口对是否为TURN服务器分配的IP地址/端口对,是则执行步骤41,否则执行步骤42;在步骤41中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤43;在步骤42中,所述接收端将所述第一发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;在步骤43中,所述发起端判断所述第一接收端IP地址/端口对是否为TURN服务器分配的接收端IP地址/端口对,是则执行步骤44,否则执行步骤45;在步骤44中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束;在步骤45中,所述发起端将所述第一接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。本实施例中,通过先判断步骤3中选择的IP地址/端口对是否为TURN服务器分配的IP地址/端口对,如果是则优选STUN服务器分配的IP地址/端口对,如果否则不需进一步优选,从而既有效地降低了TURN服务器的负荷,又避免了冗余操作。Referring to the flow chart of the second embodiment of the present invention shown in FIG. 4, a method for traversing network address translation in point-to-point communication includes the following steps: In
上述具体实施例二中,在所述步骤40之前还可包括步骤400,即为:所述接收端判断是否收到所述发起端发送的STUN请求消息,是则执行步骤40,否则继续执行步骤400。所述步骤41可具体包括以下步骤:在步骤410中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述发起端的发起端IP地址/端口对,是则执行步骤411,否则执行步骤42;在步骤411中,所述接收端选取所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤43。在所述步骤44之前还可包括步骤430,即为:所述发起端判断是否收到所述接收端发送的STUN请求消息,是则执行步骤44,否则继续执行步骤430。所述步骤44可具体包括以下步骤:在步骤440中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述接收端的接收端IP地址/端口对,是则执行步骤441,否则执行步骤45;在步骤441中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。In the above-mentioned specific embodiment two, step 400 may also be included before the
参见图5所示的本发明具体实施例三的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤2中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤3中,所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的IP地址/端口对,作为第一发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第一接收端IP地址/端口对;在步骤40′中,所述发起端判断所述第一接收端I P地址/端口对是否为TURN服务器分配的接收端IP地址/端口对,是则执行步骤41′,否则执行步骤42′;在步骤41′中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤43′;在步骤42′中,所述发起端将所述第一接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对;在步骤43′中,所述接收端判断所述第一发起端IP地址/端口对是否为TURN服务器分配的发起端IP地址/端口对,是则执行步骤44′,否则执行步骤45′;在步骤44′中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束;在步骤45′中,所述接收端将所述第一发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。Referring to the flow chart of the third embodiment of the present invention shown in FIG. 5, a method for traversing network address translation in point-to-point communication includes the following steps: In
上述具体实施例三中,在所述步骤40′之前还可包括步骤400′,即为:所述发起端判断是否收到所述接收端发送的STUN请求消息,是则执行步骤40′,否则继续执行步骤400′。所述步骤41′可具体包括以下步骤:在步骤410′中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述接收端的接收端IP地址/端口对,是则执行步骤411′,否则执行步骤42′;在步骤411′中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第二接收端IP地址/端口对,并将所述第二接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤43′。在所述步骤44′之前还可包括:步骤430′,即为:所述接收端判断是否收到所述发起端发送的STUN请求消息,是则执行步骤44′,否则继续执行步骤430′。所述步骤44′可具体包括以下步骤:在步骤440′中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,检查其中是否包括能够连接到所述发起端的发起端IP地址/端口对,是则执行步骤441′,否则执行步骤45′;在步骤441′中,所述接收端选取所述邀约消息中包括的STUN服务器分配的IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第二发起端IP地址/端口对,并将所述第二发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。In the third specific embodiment above, step 400' may also be included before step 40', that is: the initiator judges whether the STUN request message sent by the receiver is received, and if yes, step 40' is executed; otherwise Proceed to step 400'. The step 41' may specifically include the following steps: In step 410', the initiator performs a connection check on the receiving end IP address/port pair allocated by the STUN server included in the response message, and checks whether it includes To the receiving end IP address/port pair of the receiving end, if yes, execute step 411', otherwise execute step 42'; in step 411', the initiator selects the receiving end assigned by the STUN server included in the response message Among the IP address/port pairs, the IP address/port pair with the highest priority that can be connected to the receiving end is used as the second receiving end IP address/port pair, and the second receiving end IP address/port For the IP address/port pair of the receiving end that establishes a point-to-point communication connection with the receiving end, then step 43' is performed. Before the step 44', it may further include: a step 430', namely: the receiving end judges whether the STUN request message sent by the initiating end is received, and if yes, execute the step 44'; otherwise, continue to execute the step 430'. The step 44' may specifically include the following steps: In step 440', the receiving end performs a connection check on the initiator IP address/port pair allocated by the STUN server included in the invitation message, and checks whether it includes an IP address/port pair that can be connected To the initiator IP address/port pair of the initiator, if yes, execute step 441', otherwise execute step 45'; in step 441', the receiver selects the IP address assigned by the STUN server included in the invitation message The IP address/port pair that can be connected to the initiator and has the highest priority in the /port pair is used as the second initiator IP address/port pair, and the second initiator IP address/port pair is used as the The IP address/port pair of the originator that establishes a point-to-point communication connection with the originator, and then ends.
参见图6所示的本发明具体实施例四的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤A1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤A2中,所述接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第三发起端IP地址/端口对;在步骤A3中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤A4中,所述发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第三接收端IP地址/端口对;在步骤A5中,所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的IP地址/端口对;所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的IP地址/端口对。在本实施例中,通过在ICE方法中增加步骤A2和步骤A4所述的操作过程,从而首先优选STUN服务器分配的IP地址/端口对,进一步地简化了操作过程。Referring to the flow chart of
参见图7所示的本发明具体实施例五的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤A1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤A20中,所述接收端检查所述邀约消息中是否包括STUN服务器分配的发起端IP地址/端口对,是则执行步骤A21,否则执行步骤A3;在步骤A21中,所述接收端选取所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第三发起端IP地址/端口对;在步骤A3中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤A40中,所述发起端检查所述回应消息中是否包括STUN服务器分配的接收端IP地址/端口对,是则执行步骤A41,否则执行步骤A401;在步骤A41中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第三接收端IP地址/端口对,然后执行步骤A50;在步骤A401中,所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第四发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第四接收端IP地址/端口对;在步骤A50中,所述接收端判断是否已选取所述第三发起端IP地址/端口对,是则执行步骤A51,否则执行步骤A52;在步骤A51中,所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后执行步骤A53;在步骤A52中,所述接收端将所述第四发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对;在步骤A53中,所述发起端判断是否已选取所述第三接收端IP地址/端口对,是则执行步骤A54,否则执行步骤A55;在步骤A54中,所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束;在步骤A55中,所述发起端将所述第四接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后结束。在本实施例中,在首先优选STUN服务器分配的IP地址/端口对时,进一步地先判断是否存在STUN服务器分配的IP地址/端口对,并且根据连接检查的结果选择建立点对点通信连接的IP地址/端口对,从而既有效地降低了TURN服务器的负荷,又简化了操作过程,避免了冗余操作。Referring to the flow chart of the fifth embodiment of the present invention shown in FIG. 7, a method for traversing network address translation in point-to-point communication includes the following steps: In step A1, the initiator collects the STUN/TURN server distribution to the initiator. All initiator IP address/port pairs including IP address/port pairs, and the priority corresponding to each initiator IP address/port pair, among them, the initiator’s local IP address/port pair has the highest priority, and the STUN server assigns The priority of the IP address/port pair assigned by the TURN server is next, and the IP address/port pair assigned by the TURN server has the lowest priority, and then send the collected initiator IP address/port pair and corresponding priority to the receiving end through an invitation message; In step A20, the receiving end checks whether the invitation message includes the initiator IP address/port pair assigned by the STUN server, if yes, execute step A21, otherwise execute step A3; in step A21, the receiving end selects the The initiator IP address/port pair assigned by the STUN server included in the invitation message, which can be connected to the initiator and has the highest priority IP address/port pair, is used as the third initiator IP address/port pair; In step A3, the receiving end collects all receiving end IP address/port pairs including the IP address/port pair assigned to the receiving end by the STUN/TURN server, and the corresponding priority of each receiving end IP address/port pair. Among them, the local IP address/port pair of the receiving end has the highest priority, the IP address/port pair assigned by the STUN server has the second priority, and the IP address/port pair assigned by the TURN server has the lowest priority, and then the collected The receiving end IP address/port pair and the corresponding priority are sent to the initiator; in step A40, the initiator checks whether the response message includes the receiving end IP address/port pair assigned by the STUN server, If yes, execute step A41, otherwise execute step A401; in step A41, the initiator selects the receiving end IP address/port pair assigned by the STUN server included in the response message, which can be connected to the receiving end, And the IP address/port pair with the highest priority is used as the third receiving end IP address/port pair, and then step A50 is performed; /port pair for connection check, select the initiator IP address/port pair that can be connected to the initiator and has the highest priority as the fourth initiator IP address/port pair; Each receiving end IP address/port pair included is checked for connection, and the receiving end IP address/port pair that can be connected to the receiving end and has the highest priority is selected as the fourth receiving end IP address/port pair; in step In A50, the receiving end judges whether the IP address/port pair of the third initiator has been selected, if yes, execute step A51, otherwise execute step A52; in step A51, the receiving end selects the third initiator The IP address/port pair is used as the initiator IP address/port pair to establish a point-to-point communication connection with the initiator, and then step A53 is performed; in step A52, the receiving end uses the fourth initiator IP address/port pair As the initiator IP address/port pair for establishing a point-to-point communication connection with the initiator; in step A53, the initiator judges whether the third receiver IP address/port pair has been selected, and if so, step A54 is performed, Otherwise, step A55 is performed; in step A54, the initiator uses the third receiving end IP address/port pair as the receiving end IP address/port pair to establish a point-to-point communication connection with the receiving end, and then ends; in step In A55, the initiating end uses the fourth receiving end IP address/port pair as the receiving end IP address/port pair for establishing a point-to-point communication connection with the receiving end, and then ends. In this embodiment, when at first the IP address/port pair that STUN server distributes is preferred, further judge whether to have the IP address/port pair that STUN server distributes first, and select the IP address that establishes point-to-point communication connection according to the result of connection inspection /port pair, which not only effectively reduces the load on the TURN server, but also simplifies the operation process and avoids redundant operations.
参见图8所示的本发明具体实施例六的流程图,一种点对点通信中穿越网络地址转换的方法,包括以下步骤:在步骤A1中,发起端收集包括STUN/TURN服务器分配给该发起端的IP地址/端口对在内的所有发起端IP地址/端口对,以及每个发起端IP地址/端口对对应的优先级,其中,发起端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过邀约消息将收集到的发起端IP地址/端口对及对应的优先级发送给接收端;在步骤A20中,所述接收端检查所述遨约消息中是否包括STUN服务器分配的发起端IP地址/端口对,是则执行步骤A21,否则执行步骤A3;在步骤A21中,所述接收端选取所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对中的、能够连接到所述发起端的、且优先级最高的IP地址/端口对,作为第三发起端IP地址/端口对;在步骤A3中,所述接收端收集包括STUN/TURN服务器分配给该接收端的IP地址/端口对在内的所有接收端IP地址/端口对,以及每个接收端IP地址/端口对对应的优先级,其中,接收端本地的IP地址/端口对优先级最高,STUN服务器分配的IP地址/端口对优先级次之,TURN服务器分配的IP地址/端口对优先级最低,然后通过回应消息将收集到的接收端IP地址/端口对及对应的优先级发送给所述发起端;在步骤A40中,所述发起端检查所述回应消息中是否包括STUN服务器分配的接收端IP地址/端口对,是则执行步骤A41,否则执行步骤A401;在步骤A41中,所述发起端选取所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对中的、能够连接到所述接收端的、且优先级最高的IP地址/端口对,作为第三接收端IP地址/端口对,然后执行步骤A50′;在步骤401中,所述接收端对所述邀约消息中包括的每个发起端IP地址/端口对进行连接检查,选取其中能够连接到所述发起端且优先级最高的发起端IP地址/端口对,作为第四发起端IP地址/端口对;所述发起端对所述回应消息中包括的每个接收端IP地址/端口对进行连接检查,选取其中能够连接到所述接收端且优先级最高的接收端IP地址/端口对,作为第四接收端IP地址/端口对;在步骤A50′中,所述发起端判断是否已选取所述第三接收端IP地址/端口对,是则执行步骤A51′,否则执行步骤A52′;在步骤A51′中,所述发起端将所述第三接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对,然后执行步骤A53′;在步骤A52′中,所述发起端将所述第四接收端IP地址/端口对作为与所述接收端建立点对点通信连接的接收端IP地址/端口对;在步骤A53′中,所述接收端判断是否已选取所述第三发起端IP地址/端口对,是则执行步骤A54′,否则执行步骤A55′;在步骤A54′中,所述接收端将所述第三发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束;在步骤A55′中,所述接收端将所述第四发起端IP地址/端口对作为与所述发起端建立点对点通信连接的发起端IP地址/端口对,然后结束。Referring to the flow chart of Embodiment 6 of the present invention shown in FIG. 8 , a method for traversing network address translation in point-to-point communication includes the following steps: In step A1, the initiator collects the IP addresses assigned to the initiator by the STUN/TURN server. All initiator IP address/port pairs including IP address/port pairs, and the priority corresponding to each initiator IP address/port pair, among them, the initiator’s local IP address/port pair has the highest priority, and the STUN server assigns The priority of the IP address/port pair assigned by the TURN server is next, and the IP address/port pair assigned by the TURN server has the lowest priority, and then send the collected initiator IP address/port pair and corresponding priority to the receiving end through an invitation message; In step A20, the receiving end checks whether the IP address/port pair of the originating end assigned by the STUN server is included in the communication appointment message, if yes, step A21 is executed, otherwise step A3 is executed; in step A21, the receiving end selects The initiator IP address/port pair assigned by the STUN server included in the invitation message, which can be connected to the initiator and has the highest priority IP address/port pair, is used as the third initiator IP address/port pair ; In step A3, the receiving end collects all receiving end IP addresses/port pairs including the IP address/port pair assigned to the receiving end by the STUN/TURN server, and each receiving end IP address/port pair corresponds to Priority, among them, the local IP address/port pair of the receiving end has the highest priority, the IP address/port pair assigned by the STUN server has the second priority, and the IP address/port pair assigned by the TURN server has the lowest priority, and then the response message will send The collected receiver IP address/port pair and the corresponding priority are sent to the initiator; in step A40, the initiator checks whether the response message includes the receiver IP address/port pair assigned by the STUN server , if yes, execute step A41, otherwise execute step A401; in step A41, the initiator selects the receiving end IP address/port pair assigned by the STUN server included in the response message, which can be connected to the receiving end , and the IP address/port pair with the highest priority, as the third receiving end IP address/port pair, and then perform step A50'; in step 401, the receiving end will The IP address/port pair is checked for connection, and the initiator IP address/port pair with the highest priority that can be connected to the initiator is selected as the fourth initiator IP address/port pair; the initiator responds to the Each receiving end IP address/port pair included in the message performs a connection check, and selects the receiving end IP address/port pair that can be connected to the receiving end and has the highest priority as the fourth receiving end IP address/port pair; In step A50', the initiator judges whether the IP address/port pair of the third receiving end has been selected, if yes, execute step A51', otherwise execute step A52'; in step A51', the initiator will The third receiving end IP address/port pair is used as the receiving end IP address/port pair for establishing a point-to-point communication connection with the receiving end, and then step A53' is performed; in step A52', the initiator transfers the first Four receiving end IP address/port pairs as the receiving end IP address/port pair for establishing a point-to-point communication connection with the receiving end; in step A53', the receiving end judges whether the third initiator IP address/port pair has been selected Port pair, if yes, execute step A54', otherwise execute step A55'; in step A54', the receiving end uses the third initiator IP address/port pair as the initiator to establish a point-to-point communication connection with the initiator terminal IP address/port pair, and then end; in step A55', the receiving end uses the fourth initiator IP address/port pair as the initiator IP address/port pair to establish a point-to-point communication connection with the initiator , and end.
上述具体实施例四、五、六中,步骤A2中所述的接收端对所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对进行连接检查可具体包括:所述接收端将所述邀约消息中包括的STUN服务器分配的发起端IP地址/端口对作为目的IP地址/端口对,并向该目的IP地址/端口对发送UDP消息。步骤A4中所述的发起端对所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对进行连接检查可具体包括:所述发起端将所述回应消息中包括的STUN服务器分配的接收端IP地址/端口对作为目的IP地址/端口对,并向该目的IP地址/端口对发送UDP消息。In the above
最后所应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或者等同替换,而不脱离本发明技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be The scheme shall be modified or equivalently replaced without departing from the spirit and scope of the technical scheme of the present invention.
Claims (19)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100768806A CN100521663C (en) | 2006-04-18 | 2006-04-18 | Method for crossing network address conversion in point-to-point communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100768806A CN100521663C (en) | 2006-04-18 | 2006-04-18 | Method for crossing network address conversion in point-to-point communication |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1968226A true CN1968226A (en) | 2007-05-23 |
CN100521663C CN100521663C (en) | 2009-07-29 |
Family
ID=38076779
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2006100768806A Expired - Fee Related CN100521663C (en) | 2006-04-18 | 2006-04-18 | Method for crossing network address conversion in point-to-point communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100521663C (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101179581B (en) * | 2007-12-13 | 2010-06-09 | 北京邮电大学 | A method for media transmission using ICE relay candidate addresses |
CN101242360B (en) * | 2008-03-13 | 2010-12-01 | 中兴通讯股份有限公司 | A network address conversion method and system based on priority queue |
CN101227390B (en) * | 2008-01-22 | 2011-10-26 | 中兴通讯股份有限公司 | Method for implementing priority level for generating order of mapping item for network address conversion |
CN101286928B (en) * | 2008-05-08 | 2012-05-02 | 蒋一 | Method for realizing P2P stream media system based on bandwidth guarantee technology |
CN101437036B (en) * | 2008-12-22 | 2012-08-29 | 北京中企开源信息技术有限公司 | Document transmission method and system capable of supporting NAT/firewall traversing |
CN103108054A (en) * | 2011-11-11 | 2013-05-15 | 中国移动通信集团公司 | Method for penetrating through transit server and corresponding server and terminal and system |
CN103957287A (en) * | 2014-04-25 | 2014-07-30 | 浙江大学城市学院 | Internet of things device P2P connection method based on NAT penetration adapter |
CN104052743A (en) * | 2014-06-16 | 2014-09-17 | 华为技术有限公司 | A communication method and terminal |
WO2014190487A1 (en) * | 2013-05-28 | 2014-12-04 | 华为技术有限公司 | Session connection establishment method, apparatus and system |
WO2015081691A1 (en) * | 2013-12-05 | 2015-06-11 | 中兴通讯股份有限公司 | Media resource sharing method, shared server and shared system |
CN105897761A (en) * | 2016-06-15 | 2016-08-24 | 北京众享比特科技有限公司 | ICE (Internet Communications Engine) serving method, ICE server and ICE client |
CN103108054B (en) * | 2011-11-11 | 2016-12-14 | 中国移动通信集团公司 | Pass through method and corresponding server, terminal and the system of transfer server |
CN108063921A (en) * | 2017-12-26 | 2018-05-22 | 天津天地人和企业管理咨询有限公司 | A kind of optimization application process of embedded network monitoring equipment in P2P |
CN108234398A (en) * | 2016-12-15 | 2018-06-29 | 中国电信股份有限公司 | Multimedia communication method and system and relevant device |
CN109274735A (en) * | 2018-09-11 | 2019-01-25 | 腾讯科技(深圳)有限公司 | A kind of peer-to-peer network connection method and relevant device |
CN110113439A (en) * | 2019-04-09 | 2019-08-09 | 华南理工大学 | A kind of method that NAT is passed through |
-
2006
- 2006-04-18 CN CNB2006100768806A patent/CN100521663C/en not_active Expired - Fee Related
Cited By (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101179581B (en) * | 2007-12-13 | 2010-06-09 | 北京邮电大学 | A method for media transmission using ICE relay candidate addresses |
CN101227390B (en) * | 2008-01-22 | 2011-10-26 | 中兴通讯股份有限公司 | Method for implementing priority level for generating order of mapping item for network address conversion |
CN101242360B (en) * | 2008-03-13 | 2010-12-01 | 中兴通讯股份有限公司 | A network address conversion method and system based on priority queue |
CN101286928B (en) * | 2008-05-08 | 2012-05-02 | 蒋一 | Method for realizing P2P stream media system based on bandwidth guarantee technology |
CN101437036B (en) * | 2008-12-22 | 2012-08-29 | 北京中企开源信息技术有限公司 | Document transmission method and system capable of supporting NAT/firewall traversing |
CN103108054A (en) * | 2011-11-11 | 2013-05-15 | 中国移动通信集团公司 | Method for penetrating through transit server and corresponding server and terminal and system |
WO2013067870A1 (en) * | 2011-11-11 | 2013-05-16 | 中国移动通信集团公司 | Method for traversing the translator server and the corresponding server, terminal, system |
CN103108054B (en) * | 2011-11-11 | 2016-12-14 | 中国移动通信集团公司 | Pass through method and corresponding server, terminal and the system of transfer server |
WO2014190487A1 (en) * | 2013-05-28 | 2014-12-04 | 华为技术有限公司 | Session connection establishment method, apparatus and system |
WO2015081691A1 (en) * | 2013-12-05 | 2015-06-11 | 中兴通讯股份有限公司 | Media resource sharing method, shared server and shared system |
CN103957287A (en) * | 2014-04-25 | 2014-07-30 | 浙江大学城市学院 | Internet of things device P2P connection method based on NAT penetration adapter |
CN103957287B (en) * | 2014-04-25 | 2017-11-17 | 浙江大学城市学院 | A kind of internet of things equipment P2P connection methods that adapter is penetrated based on NAT |
CN104052743A (en) * | 2014-06-16 | 2014-09-17 | 华为技术有限公司 | A communication method and terminal |
WO2015192682A1 (en) * | 2014-06-16 | 2015-12-23 | 华为技术有限公司 | Communication method and terminal |
CN105897761A (en) * | 2016-06-15 | 2016-08-24 | 北京众享比特科技有限公司 | ICE (Internet Communications Engine) serving method, ICE server and ICE client |
CN108234398A (en) * | 2016-12-15 | 2018-06-29 | 中国电信股份有限公司 | Multimedia communication method and system and relevant device |
CN108234398B (en) * | 2016-12-15 | 2021-01-08 | 中国电信股份有限公司 | Multimedia communication method and system and related equipment |
CN108063921A (en) * | 2017-12-26 | 2018-05-22 | 天津天地人和企业管理咨询有限公司 | A kind of optimization application process of embedded network monitoring equipment in P2P |
CN109274735A (en) * | 2018-09-11 | 2019-01-25 | 腾讯科技(深圳)有限公司 | A kind of peer-to-peer network connection method and relevant device |
CN109274735B (en) * | 2018-09-11 | 2021-09-14 | 腾讯科技(深圳)有限公司 | Peer-to-peer network connection method and related equipment |
CN110113439A (en) * | 2019-04-09 | 2019-08-09 | 华南理工大学 | A kind of method that NAT is passed through |
CN110113439B (en) * | 2019-04-09 | 2020-09-22 | 华南理工大学 | A method of NAT traversal |
Also Published As
Publication number | Publication date |
---|---|
CN100521663C (en) | 2009-07-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1968226A (en) | Method for crossing network address conversion in point-to-point communication | |
US11019117B2 (en) | Conferencing server | |
CN100454905C (en) | Method of Traversing Network Address Translation | |
KR101139675B1 (en) | Traversal of symmetric network address translator for multiple simultaneous connections | |
CN102685268B (en) | Fast private network traversal method based on ICE (Information and Content Exchange) protocol in VoIP (Voice over Internet Protocol) | |
CN103023797A (en) | Data center system and device and method for providing service | |
US20040153858A1 (en) | Direct peer-to-peer transmission protocol between two virtual networks | |
CN101610285B (en) | P2P communication method in the coexistence network of IPv4 and IPv6 | |
JP2015521436A (en) | NAT traversal for VoIP | |
WO2009052668A1 (en) | A nat-pt device and a load-sharing method for nat-pt device | |
CN102420774B (en) | Method for realizing intranet penetration by using Internet group management protocol (IGMP) and intranet penetration system | |
WO2007041417A1 (en) | Peer-to-peer communication traversing symmetric network address translators | |
CN103023942A (en) | Load balancing method, device and system of server | |
JP2008306726A (en) | Determining connectivity between endpoints in network | |
CN101431464A (en) | Method and apparatus for optimizing data transmission route between clients | |
CN111435922B (en) | Bandwidth sharing method | |
WO2005109785A1 (en) | Information processing device, and bubble packet transmission method and program | |
CN101047548A (en) | Communication in multiple NAT private network | |
CN114363410B (en) | Application access method, cloud agent and node agent components, equipment, medium | |
CN101321128A (en) | Communication device, communication network system and communication method | |
WO2007019809A1 (en) | A method and ststem for establishing a direct p2p channel | |
CN100426769C (en) | Method for establishing pier-to-pier direct channels | |
CN1391384A (en) | Methods for identifying user device in communication systems, communication systems and apparatus | |
US9413653B2 (en) | Communication system and server | |
Tseng et al. | Can: A context-aware NAT traversal scheme |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090729 |