CN104427008A - NAT crossing method and system for TCP, third-party server X and client - Google Patents

NAT crossing method and system for TCP, third-party server X and client Download PDF

Info

Publication number
CN104427008A
CN104427008A CN201310382234.2A CN201310382234A CN104427008A CN 104427008 A CN104427008 A CN 104427008A CN 201310382234 A CN201310382234 A CN 201310382234A CN 104427008 A CN104427008 A CN 104427008A
Authority
CN
China
Prior art keywords
tcp
client
source
nat device
party server
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.)
Pending
Application number
CN201310382234.2A
Other languages
Chinese (zh)
Inventor
初鹏飞
谭磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Founder Information Industry Holdings Co Ltd
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Original Assignee
Founder Information Industry Holdings Co Ltd
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Founder Information Industry Holdings Co Ltd, Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Founder Information Industry Holdings Co Ltd
Priority to CN201310382234.2A priority Critical patent/CN104427008A/en
Publication of CN104427008A publication Critical patent/CN104427008A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/663Transport layer addresses, e.g. aspects of transmission control protocol [TCP] or user datagram protocol [UDP] ports
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1073Registration or de-registration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/163In-band adaptation of TCP data exchange; In-band control procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses an NAT crossing method for a TCP. The method comprises: a source client sending a connection request message to a third-party server X; the third-party server X, after receiving the connection request message, sending end point information of a source NAT device corresponding to the source client to a target client, and notifying the target client of initiating a TCP connection to the source NAT device corresponding to the source client; the target client initiating the TCP connection to the source NAT device; the third-party server X sending the end point information of the target NAT device to the source client; the source client, after receiving the end point information, initiating the TCP connection to the target NAT device; and the target NAT device sending packets from the source NAT device to the target client. Through such a method, TCP connections can be established for clients in different NAT networks. Compared to an NAT crossing method for a UDP, the method improves data communication reliability and can perform self-adaptive adjustment in case of a network congestion condition.

Description

For the NAT through method of TCP, system, third-party server X and client
Technical field
The present invention relates to the communications field, particularly a kind of NAT through method for TCP, system, third-party server X and client.
Background technology
The extensive existence of current NAT device, a lot of obstacle is brought to the communication between the main frame be in different Intranet, main cause is wherein that NAT does not allow public network main frame initiatively to access intranet host, this just make public network IP address initiatively can not access NAT after main frame, and mutual access between main frame after being in different N AT is difficult especially.Therefore, effective P2P communication to be carried out between different NAT, a kind of method just must be had to carry out passing through NAT.
Current comparative maturity and to use more be NAT through method for UDP.But in use there are the following problems for the NAT through method of UDP: one, fire compartment wall generally only allow specific protocol by opening in advance and port, thus make data reliability directly not ensured, must add extra process in application layer; They are two years old; Some fire compartment wall also closes udp port, and this just causes Connection Service and can not be guaranteed in these cases, and cause cannot carrying out of communication, they are three years old; When network is originally congested, continuation is sent a large amount of packets to network by UDP method of attachment, therefore can aggravate congestion, even causes the paralysis of whole communication network.
Therefore, for the communication of NAT device, need a kind of NAT through method for TCP, thus solve the problem.
Summary of the invention
The invention provides a kind of NAT through method for TCP, system, third-party server X and client, during for solving the communication of NAT device in prior art, adopting UDP method of attachment can emphasis network congestion problems.
For achieving the above object, the invention provides a kind of NAT through method for TCP, described method comprises:
Source client sends connection request message to third-party server X, and described connection request message is used for request and is connected with destination client;
The terminal point information of source NAT device corresponding for source client, after receiving described connection request message, is sent to destination client by third-party server X, and notification target client initiates TCP connection to the source NAT device that source client is corresponding;
Destination client is initiated TCP to source NAT device and is connected;
Third-party server X sends the terminal point information of target NAT device corresponding to destination client to source client;
Source client, after the terminal point information receiving target NAT device, is initiated TCP to target NAT device and is connected;
Target NAT device checks the TCP connection that source client is initiated, and after inspection is by rear permission, the grouping from source NAT device is sent to destination client;
Wherein, to initiate to source NAT device the target endpoint information that departures when TCP connects divide into groups identical in source client source endpoint information and the destination client of initiating inbound grouping when TCP connects to target NAT device; It is identical that the source endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in client target endpoint information and the destination client of initiating inbound grouping when TCP connects to target NAT device in source.
Preferably, source client and destination client are online client, source client and destination client are when reaching the standard grade, set up Article 1 TCP with third-party server X to be respectively connected, wherein, source client is connected with third-party server X by source NAT device, and destination client is connected with third-party server X by target NAT device, records the log-on message of source client and destination client respectively to make described third-party server X.
Preferably, the step that TCP connection is initiated to source NAT device in described destination client comprises;
Destination client is set up Article 2 TCP with third-party server X and is connected;
Destination client is closed and is connected with the described Article 2 TCP that third-party server X sets up, and closes message by being connected to send with the Article 1 TCP between third-party server X;
After third-party server X receives the closedown message of destination client transmission, the Article 2 TCP that record is closed connects corresponding terminal point information;
Destination client employing port reuse technology reuses the port numbers that described destination client is connected with the described Article 2 TCP between third-party server, and adopts this port numbers to initiate TCP connection to source NAT device;
After TCP connection is initiated to source NAT device in destination client, destination client is to third-party server X ready for sending message.
Preferably, described source client also comprises: source client is set up Article 2 TCP with third-party server X and is connected before sending connection request message to third-party server X;
The terminal point information of the source NAT device that described source client is corresponding is that the described Article 2 TCP between source client with third-party server X connects corresponding terminal point information;
Described source client is after the terminal point information receiving target NAT device, and the step initiating TCP connection to target NAT device comprises; Source client is closed and is connected with the described Article 2 TCP between third-party server X; Source client adopts port reuse technology to reuse the port numbers of above-mentioned Article 2 TCP connection, and initiates TCP connection to target NAT device.
For achieving the above object, present invention also offers a kind of NAT through method for TCP, described method comprises:
The connection request message that reception source client sends, described connection request message is used for request and is connected with described destination client;
After receiving described connection request message, the terminal point information of source NAT device corresponding for source client is sent to destination client, and notification target client initiates TCP connection to source NAT device;
Assist destination client to initiate TCP to source NAT device to connect;
After TCP connection is initiated to source NAT device in destination client, the terminal point information of target NAT device is sent to source client, to make described source client after the terminal point information obtaining target NAT device, set up TCP with destination client to be connected, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
Preferably, on the client during line, allow destination client to set up Article 1 TCP with it and be connected; And recording the log-on message of described client, described log-on message comprises described Article 1 TCP and connects corresponding terminal point information.
Preferably, the step that TCP connection is initiated to source NAT device in described assistance destination client comprises:
Allow destination client to set up Article 2 TCP with it to be connected;
The closedown message that receiving target client sends, and the terminal point information recording the Article 2 TCP connection correspondence of closing described destination client; Wherein, described closedown message is for notifying the closedown that described Article 2 TCP connects;
The ready message that receiving target client sends.
For achieving the above object, present invention also offers a kind of NAT through method for TCP, described method comprises:
Connected by TCP and send connection request message to third-party server X, described connection request message is used for request and is connected with destination client;
Receive the terminal point information of the NAT device corresponding with destination client that third-party server X sends;
After the terminal point information receiving the NAT device corresponding with destination client, the NAT device corresponding to destination client according to described terminal point information is initiated TCP and is connected, and is connected to set up TCP by described NAT device with described destination client.
Preferably, also comprised before third-party server X transmission connection request message by TCP connection described:
Set up Article 1 TCP with third-party server X to be connected;
Set up Article 2 TCP with third-party server X to be connected;
Wherein, described connection by TCP has been connected to third-party server X transmission connection request message by described Article 1 TCP;
The described NAT device corresponding to destination client is initiated TCP connection and is comprised:
Close and be connected with the Article 2 TCP between third-party server X;
Adopt port reuse technology to reuse the port numbers of described Article 2 TCP connection, and the NAT device corresponding to destination client initiate TCP connection, is connected to set up TCP by described NAT device with described destination client.
For achieving the above object, present invention also offers a kind of NAT through method for TCP, described method comprises:
The terminal point information of the NAT device that the source client that reception third-party server X sends is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding;
After the notice receiving the NAT device initiation TCP connection corresponding to source client, initiate TCP to the NAT device that source client is corresponding and connect;
The TCP received from described source client connects, and described TCP connects grouping and forwarded by NAT device.
Preferably, also comprise before the terminal point information of the NAT device that the source client sent at described reception third-party server X is corresponding:
Set up Article 1 TCP with third-party server X to be connected;
The described NAT device corresponding to source client is initiated TCP connection and is comprised:
Set up Article 2 TCP with third-party server X to be connected;
After setting up described Article 2 TCP and connecting, closedown is set up Article 2 TCP with third-party server X and is connected, and connect transmission closedown message by described Article 1 TCP, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record;
After the described Article 2 TCP of closedown connects, adopt port reuse technology to reuse the port numbers of described Article 2 TCP connection, and connect to the NAT device initiation TCP that source client is corresponding;
After the NAT device corresponding to source client initiates TCP connection, to third-party server X ready for sending message, after receiving described ready message, the described Article 2 TCP of record is connected corresponding terminal point information to make third-party server X and send to described source client.
For achieving the above object, present invention also offers a kind of third-party server X, described third-party server X comprises:
Third-party server X comprises:
Registration Module, the client of described Registration Module in private network is set up for putting on record to client when Article 1 TCP is connected with described third-party server X, terminal point information when being connected with third-party server X with the user name and client that record NAT device corresponding to client;
Connection handling module, described connection handling module is used for setting up TCP for two clients being positioned at different private network and connects; Wherein, described connection handling module specifically comprises:
Connection request response submodule, the connection request message that described connection request response submodule sends for receiving source client, described connection request message is used for asking to set up TCP with destination client and is connected;
Notice submodule, described notice submodule is used for after the corresponding submodule of connection request receives described connection request message, the terminal point information of NAT device corresponding for source client is sent to described destination client, and notifies that the described destination client NAT device corresponding with source client connects;
Record sub module, described record sub module is used for after the closedown message receiving the transmission of described destination client, records the terminal point information corresponding to pent TCP connection;
Response submodule, described response submodule is used for after the ready message receiving the transmission of described destination client, terminal point information record sub module recorded sends to described source client, initiate TCP with the NAT device making described source client corresponding to destination client according to described terminal point information to connect, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
Preferably, also comprise transceiver module, described transceiver module for TCP connection request, the client receiving client and send send for asking to set up with destination client connection request message that TCP is connected, closing message and ready message; Described transceiver module is also for sending to described destination client by the terminal point information of NAT device corresponding for source client, and terminal point information record sub module recorded sends to described source client.
For achieving the above object, present invention also offers a kind of client, described client comprises:
Connection request module, sends connection request message for being connected by TCP to third-party server X, and described connection request message is used for request and is connected with destination client;
Target endpoint data obtaining module, for receiving the terminal point information of the NAT device corresponding with destination client that third-party server X sends;
TCP link block, for after the terminal point information receiving the NAT device corresponding with destination client, the NAT device corresponding to destination client according to described terminal point information is initiated TCP and is connected, and is connected to set up TCP by described NAT device with described destination client.
Preferably, described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected;
Described connection request module comprises server connexon module, and described server connexon module is used for, before sending connection request message to third-party server X, setting up Article 2 TCP be connected with third-party server X;
Described TCP link block comprises:
Close closed submodule, be connected for the Article 2 TCP closed between third-party server X;
Destination client reconnects submodule, and for the port numbers adopting port reuse technology to reuse described Article 2 TCP connection, and the NAT device corresponding to destination client initiates TCP connection, is connected to set up TCP by described NAT device with described destination client.
For achieving the above object, present invention also offers a kind of client, described client comprises:
Source endpoint data obtaining module, the terminal point information of the NAT device that the source client for receiving third-party server X transmission is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding;
Source client's side link module, for after the notice receiving the NAT device initiation TCP connection corresponding to source client, initiates TCP to the NAT device that source client is corresponding and connects;
Monitor module, connect for the TCP received from described source client, described TCP connects grouping and is forwarded by NAT device.
Preferably, described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected;
Described source client's side link module comprises:
Connexon module, is connected for setting up Article 2 TCP with third-party server X;
Close and notice submodule, for after setting up described Article 2 TCP and connecting, close described Article 2 TCP to connect, and connect transmission closedown message by described Article 1 TCP, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record;
Source reconnects submodule, after connecting at the described closedown Article 2 TCP of closedown, adopts port reuse technology to reuse the port numbers of described Article 2 TCP connection, and connects to the NAT device initiation TCP that source client is corresponding;
Ready notice submodule, after initiating TCP connection at the NAT device corresponding to source client, to third-party server X ready for sending message, after receiving described ready message, the described Article 2 TCP of record is connected corresponding terminal point information to make third-party server X and send to described source client.
For achieving the above object, present invention also offers a kind of NAT ride through system for TCP, described NAT ride through system comprises above-mentioned arbitrary third-party server X, and above-mentioned any client.
The present invention has following beneficial effect:
The present invention is after taking technique scheme, the port of socket is utilized to reuse function, make each client at connection server X with when being connected other NAT, NAT device place in present networks is converted to identical outer net address and port numbers, like this other private networks client by they separately NAT device send grouping just can find correct port numbers, and under the coordination of third-party server X, due to Home Network client before externally NAT device sent grouping, so the grouping that other NAT send just can pass through the NAT device of Home Network smoothly, arrive internal client.Like this, reliable TCP connection has just been set up, and compare the NAT through method for UDP, the NAT through method for TCP can obtain the raising of data communication reliability, and carry out self-adaptative adjustment for network congestion situation, avoid the vicious circle of " all the more more stifled ".
Accompanying drawing explanation
Fig. 1 is topology of networks schematic diagram;
The flow chart of the NAT through method for TCP that Fig. 2 provides for the embodiment of the present invention;
The flow chart of the NAT through method for TCP that Fig. 3 provides for the embodiment of the present invention;
The flow chart of the NAT through method for TCP that Fig. 4 A and Fig. 4 B provides for the embodiment of the present invention.
Embodiment
For making those skilled in the art understand technical scheme of the present invention better, below in conjunction with accompanying drawing, the NAT through method for TCP provided by the invention, system, third-party server X and client are described in detail.The present invention is applicable to the conical NAT network architecture.
First, brief description is carried out to the topology of the network of the embodiment of the present invention.Referring to Fig. 1, is topology of networks schematic diagram.As shown in Figure 1, private network NAT-A, NAT-B etc. are connected to public network (internet), private network NAT-A comprises NAT-A equipment and multiple customer end A, these customer end A all do not have public network address, and NAT-A equipment possesses public network address, each customer end A is all connected to NAT-A equipment, and by NAT-A proxy for equipment access public network, same situation is applicable to private network NAT-B, wherein, private network NAT-B comprises NAT-B equipment and multiple customer end B, and each customer end B is all connected to NAT-B equipment.
Below based on above-mentioned network topology structure, the NAT through method for TCP, system, third-party server X and the client that the embodiment of the present invention provides is described.
Embodiment one
Embodiments provide a kind of NAT through method for TCP.In the present embodiment, the client initiating TCP connection is source client, NAT device corresponding to source client is source NAT device, the client receiving TCP connection is destination client, NAT device corresponding to destination client is target NAT device, client can be initiated TCP as source client to other clients and connect, and also can receive the TCP connection of other clients initiation as destination client.Such as, source client can be the some customer end A in private network NAT-A, and destination client can be the some customer end B in private network NAT-B.
Private network NAT in the present embodiment refers to the conical NAT network architecture.
Refer to Fig. 2, the flow chart of its NAT through method for TCP provided for the embodiment of the present invention.As shown in Figure 2, the method comprises:
Step S101, source client is set up Article 1 TCP with third-party server X and is connected.
Wherein, third-party server X refers to have public network IP address, externally can provide the server of TCP Connection Service, and any client through checking all can be set up TCP with third-party server X and be connected.
Source client and third-party server X set up after TCP is connected (source client is set up TCP by source NAT device with third-party server X and is connected), third-party server X can put on record to source client, to record the log-on message of source client, this log-on message comprises the terminal point information when user name of source NAT device corresponding to source client and source client are connected with third-party server X.Wherein, described terminal point information comprises IP address and port numbers, and here IP address is the public network address of source NAT device, and port numbers is the port numbers that source client maps on the NAT device of source.
In the embodiment of the present invention, client (comprising source client and destination client) with can set up many TCP between third-party server X and be connected, TCP is set up when being connected between each client with third-party server X, third-party server X all can record this TCP and connect corresponding terminal point information, this TCP connects the terminal point information of corresponding terminal point information and NAT device corresponding to client, above-mentioned many TCP are connected, the port numbers that client maps on NAT device is different, therefore, many TCP connects terminal point information (identical public network address and different port numbers) corresponding different respectively.
Step S102, destination client is set up Article 1 TCP with third-party server X and is connected.
Wherein, destination client and third-party server X set up after TCP is connected (destination client is set up TCP by target NAT device with third-party server X and is connected), third-party server X can put on record to destination client, with the log-on message of record object client, this log-on message comprises the terminal point information when user name of target NAT device corresponding to destination client and destination client are connected with third-party server X.Equally, terminal point information here comprises IP address and port numbers, and IP address is the public network address of target NAT device, and port numbers is the port numbers that destination client maps on target NAT device.
Wherein, when third-party server X puts on record to client, the online situation of this client can be sent in network other client.
Wherein, step S101 and step S102 order in no particular order.
Step S103, source client is set up Article 2 TCP with third-party server X and is connected.
Set up after Article 2 TCP is connected at source client and third-party server X, third-party server X records this Article 2 TCP and connects corresponding terminal point information, terminal point information comprises IP address and port numbers, and IP address is the public network address of source NAT device, port numbers is the port numbers that source client maps on the NAT device of source.
Step S104, source client is connected to third-party server X transmission connection request message by Article 1 TCP, and described connection request message is used for request and is connected with destination client.
After source client sends connection request message, source client needs, after third-party server X replys, could start linking objective NAT device.This is because: one, source client needs third-party server X to provide the terminal point information of target NAT device, thus can be connected with the destination client after target NAT device; They are two years old, source NAT device needs after destination client sent grouping to source NAT device, grouping can be sent to destination client, because in the conical NAT network architecture, in private network the network address of main frame or end points limited, sent grouping to public network main frame before and if only if private network main frame, this public network main frame can send grouping to private network main frame.Source NAT device and target NAT device are public network main frame, and source client and destination client are private network main frame.
The terminal point information of source NAT device, after receiving described connection request message, is sent to destination client by step S105, third-party server X, and notification target client initiates TCP connection to source NAT device.
Wherein, in this step, the terminal point information of said source NAT device refers to that source client and third-party server X set up Article 2 TCP when being connected, and third-party server X records this Article 2 TCP and connects corresponding terminal point information.For third-party server X, the source client after the NAT device of source is sightless, and therefore, when source client is connected with third-party server X, what third-party server X recorded is the terminal point information of source NAT device.
Step S106, destination client is initiated TCP to source NAT device and is connected.
Concrete, step S106 comprises:
Step S1061, destination client is set up Article 2 TCP with third-party server X and is connected.
Step S1062, destination client is closed and is connected with the Article 2 TCP that third-party server X sets up, and closes message by being connected to send with the Article 1 TCP between third-party server X.
Wherein, after third-party server X receives the described closedown message of destination client transmission, the Article 2 TCP that record is closed connects corresponding terminal point information.Above-mentioned closedown message is for notifying the closedown that third-party server X is connected with the Article 2 TCP between destination client.
Step S1063, the port numbers that the Article 2 TCP that destination client adopts port reuse technology to reuse to set up between destination client with third-party server X is connected, and according to the terminal point information of source NAT device that third-party server X in step S105 sends, initiate TCP to source NAT device and connect.
Step S1064, after TCP connection is initiated to source NAT device in destination client, destination client is to third-party server X ready for sending message.
Step S107, third-party server X is after the ready message receiving destination client transmission, the terminal point information of target NAT device is sent to source client, this terminal point information is that terminal point information corresponding when Article 2 TCP connects is set up with third-party server X in destination client, and notification source client initiates TCP connection to target NAT device.
Step S108, source client, after the terminal point information receiving target NAT device, according to the terminal point information of the target NAT device that third-party server X in step S107 sends, is initiated TCP to target NAT device and is connected.
Concrete, step S108 specifically comprises:
Step S1081, source client is closed and is connected with the Article 2 TCP between third-party server X.
Step S1082, source client adopts port reuse technology to reuse the port numbers of above-mentioned Article 2 TCP connection, and initiate TCP connection to target NAT device, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in the source endpoint information initiating inbound grouping when TCP connects to target NAT device to make source client and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
Because adopt port reuse, so source client and destination client are when being connected with third-party server X and when attempting to be connected with it, mapping be same port numbers.Because destination client first sends the grouping of SYN type by target NAT device to source NAT device on chronological order, so afterwards when source client sends the grouping of SYN type by source NAT device to target NAT device, it is identical that target NAT device found that the target endpoint information that departures when TCP connects divide into groups was initiated to source NAT device in source client initiates source endpoint information from inbound grouping when TCP connects to target NAT device and destination client; And to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical in source client target endpoint information and the destination client of initiating inbound grouping when TCP connects to target NAT device; So target NAT device thinks that this inbound grouping is the response data bag to grouping of just now setting off, and the grouping of this SYN type passes through target NAT smoothly thus, arrives the listening port of destination client.Wherein, SYN type is grouped into the grouping of applying in TCP connection initiation process in prior art.
Step S109, target NAT device checks the TCP connection that source client is initiated, and after inspection is by rear permission, the grouping from source NAT device is sent to destination client.
Wherein, target NAT device find the source endpoint information of inbound grouping and target endpoint information with just set off the target endpoint information of dividing into groups and source endpoint information just corresponding, so think that this inbound grouping is the response data bag to grouping of just now setting off, therefore the grouping of this SYN type passes through target NAT smoothly, arrives the listening port of destination client.
In the embodiment of the present invention, the port of socket is utilized to reuse function, the outer end slogan used when the port numbers of the opposite end (source client and destination client opposite end each other) that third-party server X is got is connected by NAT with client is consistent, makes the client in different private network successfully can set up TCP and connects.What not only solve UDP message transmission cannot ensure integrity problem, but also can be adaptive according to whole network congestion situation, regulate the traffic volume of packet, maintain the overall usability of network, the reliable communication between different Intranet can be widely used in.
Be described below in conjunction with a concrete example.Wherein,
Initiate TCP connection for the customer end A in private network NAT-A to the customer end B in private network NAT-A in this example to be described.Wherein, the public network address of the NAT-A equipment that customer end A is corresponding is (100.108.255.0), and the public network address of the NAT-B equipment that customer end B is corresponding is (200.126.255.0).
Particularly, customer end A is as follows to the process of customer end B initiation TCP connection:
Step S201, customer end A and customer end B are set up Article 1 TCP with third-party server X respectively and are connected.
Customer end A and with third-party server X set up Article 1 TCP be connected time, third-party server X records this Article 1 TCP and connects corresponding terminal point information for [(100.108.255.0), 11], wherein, (100.108.255.0) be the public network address of NAT-A equipment, 11 is customer end A sets up the port of NAT-A equipment shared when Article 1 TCP is connected port numbers with third-party server X.
Equally, customer end B and with third-party server X set up Article 1 TCP be connected time, third-party server X records this Article 1 TCP and connects corresponding terminal point information for [(200.126.255.0), 21].
Step S202, customer end A is set up Article 2 TCP with third-party server X and is connected.
Third-party server X records the terminal point information [(100.108.255.0) of the Article 2 TCP connection correspondence that customer end A is set up with it, 12], 12 be wherein customer end A sets up the port of NAT-A equipment shared when Article 2 TCP is connected port numbers with third-party server X.
Step S203, customer end A is connected to third-party server X transmission connection request message by Article 1 TCP.
Step S204, third-party server X are after the connection request message receiving customer end A transmission, and Article 2 TCP customer end A set up with it connects corresponding terminal point information [(100.108.255.0), 12] and sends to customer end B.
Step S205, customer end B is receiving terminal point information [(100.108.255.0), 12], initiates TCP connection according to this terminal point information [(100.108.255.0), 12] to the NAT-A equipment of correspondence.
Particularly, step S2051, customer end B is set up Article 2 TCP with third-party server X and is connected.
Third-party server X records the terminal point information [(200.126.255.0), 22] of the Article 2 TCP connection correspondence that customer end B is set up with it.
Step S2052, customer end B closedown is set up Article 2 TCP with third-party server X and is connected, and utilizes port reuse technology to initiate TCP connection to NAT-A equipment.
Owing to have employed port reuse technology, customer end B has reused the port 22 on NAT-B equipment, therefore, when customer end B initiates TCP connection to NAT-A equipment, the target endpoint information of its departures grouping is [(100.108.255.0), 12], the source endpoint information of its departures grouping is [(200.126.255.0), 22].
Step S2053, customer end B to NAT-A equipment initiate TCP connect after, to third-party server X ready for sending message.
Step S206, after third-party server X receives this ready message, the Article 2 TCP customer end B recorded before set up with it connects corresponding terminal point information [(200.126.255.0), 22] and sends to customer end A.
Step S207, after customer end A receives the terminal point information of third-party server X transmission, initiates TCP connection according to this terminal point information to the NAT-B equipment of correspondence.
Particularly, customer end A closedown is set up Article 2 TCP with third-party server X and is connected, and utilizes port reuse technology to initiate TCP connection to NAT-B equipment.
Owing to have employed port reuse technology, customer end A has reused the port one 2 on NAT-A equipment, therefore, when customer end A initiates TCP connection to NAT-B equipment, the target endpoint information of its TCP connection request grouping (relative to NAT-A equipment for departures are divided into groups, being station grouping relative to NAT-B equipment) is [(200.126.255.0), 22], source endpoint information is [(100.108.255.0), 12].
Step S208, after NAT-B equipment receives inbound grouping (above-mentioned TCP connection request grouping), find that the source endpoint information that the target endpoint information of inbound grouping and customer end B initiate departures grouping when TCP is connected to NAT-A equipment is identical, the target endpoint information that source endpoint information and the customer end B of this inbound grouping initiate departures grouping when TCP is connected to NAT-A equipment is identical, therefore target NAT device thinks that this inbound grouping is the response data bag to grouping of just now setting off, therefore, by this inbound forwarding of packets to customer end B.Therefore this TCP connection request grouping (such as SYN type grouping) smoothly passing through NAT-B is arranged, and arrives customer end B, therefore, successfully sets up TCP and connect between customer end A and customer end B.
Embodiment two
The embodiment of the present invention additionally provides a kind of NAT through method for TCP.Refer to Fig. 3, the flow chart of its NAT through method for TCP provided for the embodiment of the present invention.As shown in Figure 3, the method comprises:
Step S201, third-party server X allow source client to be connected with the Article 1 TCP of its foundation.
Step S202, third-party server X allow destination client to be connected with the Article 1 TCP of its foundation.
Wherein, step S201 and step S202 order in no particular order.
Step S203, third-party server X allow source client to be connected with the Article 2 TCP of its foundation.
Step S204, third-party server X are received source client and are connected the connection request message sent by Article 1 TCP, and described connection request message is used for request and is connected with described destination client.
Step S205, after receiving described connection request message, the terminal point information of source NAT device is sent to destination client by third-party server X, and notification target client initiates TCP connection to source NAT device.
Step S206, third-party server X assist destination client to initiate TCP connection to source NAT device.
Concrete, step S206 comprises:
Step S2061, third-party server X allow destination client to be connected with the Article 2 TCP of its foundation.
The closedown message that step S2062, third-party server X receiving target client sends, and the Article 2 TCP that record is closed connects corresponding terminal point information.Wherein, described closedown message is for notifying the closedown that third-party server X is connected with the Article 2 TCP between destination client.
The ready message that step S2063, third-party server X receiving target client sends.
Step S207, third-party server X is after receiving described ready message, the terminal point information of target NAT device is sent to source client, to make described source client after the terminal point information obtaining target NAT device, set up TCP with destination client to be connected, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
Embodiment three
The embodiment of the present invention additionally provides a kind of NAT through method for TCP.Refer to Fig. 4 A and Fig. 4 B, the flow chart of its NAT through method for TCP provided for the embodiment of the present invention.
The NAT through method for TCP that the embodiment of the present invention provides comprises:
Client is set up TCP by third-party server X with the destination client in other private networks and is connected, and,
The source client that client is received in other private networks by third-party server X is connected with the TCP that described client is set up.
As shown in Figure 4 A, described client is set up TCP by third-party server X and the destination client in other private networks and is connected and specifically comprises:
Step S301, client is set up Article 1 TCP with third-party server X and is connected.
Step S302, client is set up Article 2 TCP with third-party server X and is connected.
Step S303, client is connected to third-party server X transmission connection request message by Article 1 TCP, and described connection request message is used for request and is connected with destination client.
Step S304, client receives the terminal point information of the NAT device corresponding with destination client that third-party server X sends.
Step S305, after the terminal point information receiving the NAT device corresponding with destination client, the NAT device initiation TCP connection that client is corresponding to destination client, is connected to set up TCP by described NAT device with described destination client.
Particularly, step S305 comprises:
Step S3051, client is closed and is connected with the Article 2 TCP between third-party server X.
Step S3052, client adopts port reuse technology to reuse the port numbers of above-mentioned Article 2 TCP connection, and initiates TCP connection to target NAT device, is connected to set up TCP by target NAT device and destination client.
As shown in Figure 4 B, described client receives source client in other private networks by third-party server X and to be connected with the TCP that described client is set up and specifically to comprise:
Step S401, client is set up Article 1 TCP with third-party server X and is connected.
Step S402, the terminal point information of the NAT device that the source client that client reception third-party server X sends is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding.
Step S403, client is initiated TCP to the NAT device that source client is corresponding and is connected.
Concrete, step S403 comprises:
Step S4031, client is set up Article 2 TCP with third-party server X and is connected.
Step S4032, client closedown is set up Article 2 TCP with third-party server X and is connected, and close message by being connected to send with the Article 1 TCP between third-party server X, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record.
Step S4033, client adopts port reuse technology to reuse the port numbers of above-mentioned Article 2 TCP connection, and initiates TCP connection to the NAT device that source client is corresponding.
Step S4034, after the NAT device that client is corresponding to source client initiates TCP connection, the terminal point information of NAT device corresponding for client, to third-party server X ready for sending message, is sent to described source client to make third-party server X by client after receiving described ready message.
Step S404, the TCP that client receives from source client connects, and described TCP connects grouping and forwarded by target NAT device.
Embodiment four
The embodiment of the present invention additionally provides a kind of third-party server X.This third-party server X comprises:
Registration Module, when the described Registration Module client be used in private network is connected with the Article 1 TCP that described third-party server X sets up, described Registration Module is put on record to client, terminal point information when being connected with third-party server X with the user name and client that record NAT device corresponding to client.
Wherein, when described client and described third-party server X set up many TCP be connected time, Registration Module connects corresponding terminal point information to each TCP respectively and carries out record.
Connection handling module, described connection handling module is used for setting up TCP for two clients being positioned at different private network and connects.Wherein, described connection handling module specifically comprises:
Connection request response submodule, the connection request message that described connection request response submodule sends for receiving source client, described connection request message is used for asking to set up TCP with destination client and is connected;
Notice submodule, described notice submodule is used for after receiving described connection request message, the terminal point information of NAT device corresponding for source client is sent to described destination client, notifies that the described destination client NAT device corresponding with source client connects;
Record sub module, described record sub module is used for after the closedown message receiving the transmission of described destination client, records the terminal point information corresponding to pent TCP connection;
Response submodule, described response submodule is used for after the ready message receiving the transmission of described destination client, terminal point information record sub module recorded sends to described source client, initiate TCP with the NAT device making described source client corresponding to destination client according to described terminal point information to connect, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
Transceiver module, described transceiver module for TCP connection request, the client receiving client and send send for asking to set up with destination client connection request message that TCP is connected, closing message and ready message; Described transceiver module is also for sending to described destination client by the terminal point information of NAT device corresponding for source client, and terminal point information record sub module recorded sends to described source client.
Embodiment five
The embodiment of the present invention additionally provides a kind of client.This client comprises:
Connection request module, sends connection request message for being connected by TCP to third-party server X, and described connection request message is used for request and is connected with destination client;
Target endpoint data obtaining module, for receiving the terminal point information of the NAT device corresponding with destination client that third-party server X sends;
TCP link block, for after the terminal point information receiving the NAT device corresponding with destination client, the NAT device corresponding to destination client is initiated TCP and is connected, and is connected to set up TCP by described NAT device with described destination client.
Preferably, described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected.
Preferably, described connection request module comprises server connexon module, and described server connexon module is used for, before sending connection request message to third-party server X, setting up Article 2 TCP be connected with third-party server X.
Preferably, described TCP link block comprises:
Close closed submodule, be connected for the Article 2 TCP closed between third-party server X;
Destination client reconnects submodule, and for the port numbers adopting port reuse technology to reuse described Article 2 TCP connection, and the NAT device corresponding to destination client initiates TCP connection, is connected to set up TCP by described NAT device with described destination client.
Preferably, described client also comprises and exits module, described in exit module for when client rolls off the production line, notice third-party server X nullifies the log-on message of described client.
Embodiment six
The embodiment of the present invention additionally provides a kind of client.This client comprises:
Source endpoint data obtaining module, the terminal point information of the NAT device that the source client for receiving third-party server X transmission is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding;
Source client's side link module, for after the notice receiving the NAT device initiation TCP connection corresponding to source client, initiates TCP to the NAT device that source client is corresponding and connects;
Monitor module, connect for the TCP received from described source client, described TCP connects grouping and is forwarded by NAT device.
Preferably, described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected.
Preferably, described source client's side link module comprises:
Connexon module, is connected for setting up Article 2 TCP with third-party server X;
Close and notice submodule, for after setting up described Article 2 TCP and connecting, close described Article 2 TCP to connect, and connect transmission closedown message by described Article 1 TCP, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record;
Source reconnects submodule, after connecting at the described closedown Article 2 TCP of closedown, adopts port reuse technology to reuse the port numbers of described Article 2 TCP connection, and connects to the NAT device initiation TCP that source client is corresponding;
Ready notice submodule, after initiating TCP connection at the NAT device corresponding to source client, to third-party server X ready for sending message, after receiving described ready message, the described Article 2 TCP of record is connected corresponding terminal point information to make third-party server X and send to described source client.
Preferably, described client also comprises and exits module, described in exit module for when client rolls off the production line, notice third-party server X nullifies the log-on message of described client.
Embodiment seven
The embodiment of the present invention additionally provides a kind of client.This client possesses the repertoire of the client provided in the client and embodiment six provided in embodiment five.
Embodiment eight
The embodiment of the present invention additionally provides a kind of NAT ride through system for TCP, described NAT ride through system any one third-party server above-mentioned X, and any one client above-mentioned.
Be understandable that, the illustrative embodiments that above execution mode is only used to principle of the present invention is described and adopts, but the present invention is not limited thereto.For those skilled in the art, without departing from the spirit and substance in the present invention, can make various modification and improvement, these modification and improvement are also considered as protection scope of the present invention.

Claims (18)

1. for a NAT through method of TCP, it is characterized in that, described method comprises:
Source client sends connection request message to third-party server X, and described connection request message is used for request and is connected with destination client;
The terminal point information of source NAT device corresponding for source client, after receiving described connection request message, is sent to destination client by third-party server X, and notification target client initiates TCP connection to the source NAT device that source client is corresponding;
Destination client is initiated TCP to source NAT device and is connected;
Third-party server X sends the terminal point information of target NAT device corresponding to destination client to source client;
Source client, after the terminal point information receiving target NAT device, is initiated TCP to target NAT device and is connected;
Target NAT device checks the TCP connection that source client is initiated, and after inspection is by rear permission, the grouping from source NAT device is sent to destination client;
Wherein, to initiate to source NAT device the target endpoint information that departures when TCP connects divide into groups identical in source client source endpoint information and the destination client of initiating inbound grouping when TCP connects to target NAT device; It is identical that the source endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in client target endpoint information and the destination client of initiating inbound grouping when TCP connects to target NAT device in source.
2. method according to claim 1, it is characterized in that, source client and destination client are online client, source client and destination client are when reaching the standard grade, set up Article 1 TCP with third-party server X to be respectively connected, wherein, source client is connected with third-party server X by source NAT device, destination client is connected with third-party server X by target NAT device, records the log-on message of source client and destination client respectively to make described third-party server X.
3. method according to claim 2, is characterized in that, the step that TCP connection is initiated to source NAT device in described destination client comprises;
Destination client is set up Article 2 TCP with third-party server X and is connected;
Destination client is closed and is connected with the described Article 2 TCP that third-party server X sets up, and closes message by being connected to send with the Article 1 TCP between third-party server X;
After third-party server X receives the closedown message of destination client transmission, the Article 2 TCP that record is closed connects corresponding terminal point information;
Destination client employing port reuse technology reuses the port numbers that described destination client is connected with the described Article 2 TCP between third-party server, and adopts this port numbers to initiate TCP connection to source NAT device;
After TCP connection is initiated to source NAT device in destination client, destination client is to third-party server X ready for sending message.
4. method according to claim 3, is characterized in that,
Described source client also comprises: source client is set up Article 2 TCP with third-party server X and is connected before sending connection request message to third-party server X;
The terminal point information of the source NAT device that described source client is corresponding is that the described Article 2 TCP between source client with third-party server X connects corresponding terminal point information;
Described source client is after the terminal point information receiving target NAT device, and the step initiating TCP connection to target NAT device comprises; Source client is closed and is connected with the described Article 2 TCP between third-party server X; Source client adopts port reuse technology to reuse the port numbers of above-mentioned Article 2 TCP connection, and initiates TCP connection to target NAT device.
5. for a NAT through method of TCP, it is characterized in that, described method comprises:
The connection request message that reception source client sends, described connection request message is used for request and is connected with described destination client;
After receiving described connection request message, the terminal point information of source NAT device corresponding for source client is sent to destination client, and notification target client initiates TCP connection to source NAT device;
Assist destination client to initiate TCP to source NAT device to connect;
After TCP connection is initiated to source NAT device in destination client, the terminal point information of target NAT device is sent to source client, to make described source client after the terminal point information obtaining target NAT device, set up TCP with destination client to be connected, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
6. method according to claim 5, is characterized in that, on the client during line, allows destination client to set up Article 1 TCP with it and is connected; And recording the log-on message of described client, described log-on message comprises described Article 1 TCP and connects corresponding terminal point information.
7. method according to claim 5, is characterized in that, the step that TCP connection is initiated to source NAT device in described assistance destination client comprises:
Allow destination client to set up Article 2 TCP with it to be connected;
The closedown message that receiving target client sends, and the terminal point information recording the Article 2 TCP connection correspondence of closing described destination client; Wherein, described closedown message is for notifying the closedown that described Article 2 TCP connects;
The ready message that receiving target client sends.
8., for a NAT through method of TCP, described method comprises:
Connected by TCP and send connection request message to third-party server X, described connection request message is used for request and is connected with destination client;
Receive the terminal point information of the NAT device corresponding with destination client that third-party server X sends;
After the terminal point information receiving the NAT device corresponding with destination client, the NAT device corresponding to destination client according to described terminal point information is initiated TCP and is connected, and is connected to set up TCP by described NAT device with described destination client.
9. method according to claim 8, is characterized in that,
Also comprised before third-party server X transmission connection request message by TCP connection described:
Set up Article 1 TCP with third-party server X to be connected;
Set up Article 2 TCP with third-party server X to be connected;
Wherein, described connection by TCP has been connected to third-party server X transmission connection request message by described Article 1 TCP;
The described NAT device corresponding to destination client is initiated TCP connection and is comprised:
Close and be connected with the Article 2 TCP between third-party server X;
Adopt port reuse technology to reuse the port numbers of described Article 2 TCP connection, and the NAT device corresponding to destination client initiate TCP connection, is connected to set up TCP by described NAT device with described destination client.
10. for a NAT through method of TCP, it is characterized in that, described method comprises:
The terminal point information of the NAT device that the source client that reception third-party server X sends is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding;
After the notice receiving the NAT device initiation TCP connection corresponding to source client, initiate TCP to the NAT device that source client is corresponding and connect;
The TCP received from described source client connects, and described TCP connects grouping and forwarded by NAT device.
11. methods according to claim 10, is characterized in that,
Also comprise before the terminal point information of the NAT device that the source client sent at described reception third-party server X is corresponding:
Set up Article 1 TCP with third-party server X to be connected;
The described NAT device corresponding to source client is initiated TCP connection and is comprised:
Set up Article 2 TCP with third-party server X to be connected;
After setting up described Article 2 TCP and connecting, closedown is set up Article 2 TCP with third-party server X and is connected, and connect transmission closedown message by described Article 1 TCP, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record;
After the described Article 2 TCP of closedown connects, adopt port reuse technology to reuse the port numbers of described Article 2 TCP connection, and connect to the NAT device initiation TCP that source client is corresponding;
After the NAT device corresponding to source client initiates TCP connection, to third-party server X ready for sending message, after receiving described ready message, the described Article 2 TCP of record is connected corresponding terminal point information to make third-party server X and send to described source client.
12. 1 kinds of third-party server X, is characterized in that, described third-party server X comprises:
Third-party server X comprises:
Registration Module, the client of described Registration Module in private network is set up for putting on record to client when Article 1 TCP is connected with described third-party server X, terminal point information when being connected with third-party server X with the user name and client that record NAT device corresponding to client;
Connection handling module, described connection handling module is used for setting up TCP for two clients being positioned at different private network and connects; Wherein, described connection handling module specifically comprises:
Connection request response submodule, the connection request message that described connection request response submodule sends for receiving source client, described connection request message is used for asking to set up TCP with destination client and is connected;
Notice submodule, described notice submodule is used for after the corresponding submodule of connection request receives described connection request message, the terminal point information of NAT device corresponding for source client is sent to described destination client, and notifies that the described destination client NAT device corresponding with source client connects;
Record sub module, described record sub module is used for after the closedown message receiving the transmission of described destination client, records the terminal point information corresponding to pent TCP connection;
Response submodule, described response submodule is used for after the ready message receiving the transmission of described destination client, terminal point information record sub module recorded sends to described source client, initiate TCP with the NAT device making described source client corresponding to destination client according to described terminal point information to connect, and set up in the process that TCP is connected in described source client and destination client, it is identical that the target endpoint information that departures when TCP connects divide into groups is initiated to source NAT device in described source client source endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before, and to initiate to source NAT device the source endpoint information that departures when TCP connects divide into groups identical source client target endpoint information from inbound grouping when TCP connects to target NAT device that initiate and destination client before.
13. third-party server X according to claim 12, it is characterized in that, also comprise transceiver module, described transceiver module for TCP connection request, the client receiving client and send send for asking to set up with destination client connection request message that TCP is connected, closing message and ready message; Described transceiver module is also for sending to described destination client by the terminal point information of NAT device corresponding for source client, and terminal point information record sub module recorded sends to described source client.
14. 1 kinds of clients, is characterized in that, described client comprises:
Connection request module, sends connection request message for being connected by TCP to third-party server X, and described connection request message is used for request and is connected with destination client;
Target endpoint data obtaining module, for receiving the terminal point information of the NAT device corresponding with destination client that third-party server X sends;
TCP link block, for after the terminal point information receiving the NAT device corresponding with destination client, the NAT device corresponding to destination client according to described terminal point information is initiated TCP and is connected, and is connected to set up TCP by described NAT device with described destination client.
15. clients according to claim 14, is characterized in that,
Described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected;
Described connection request module comprises server connexon module, and described server connexon module is used for, before sending connection request message to third-party server X, setting up Article 2 TCP be connected with third-party server X;
Described TCP link block comprises:
Close closed submodule, be connected for the Article 2 TCP closed between third-party server X;
Destination client reconnects submodule, and for the port numbers adopting port reuse technology to reuse described Article 2 TCP connection, and the NAT device corresponding to destination client initiates TCP connection, is connected to set up TCP by described NAT device with described destination client.
16. 1 kinds of clients, is characterized in that, described client comprises:
Source endpoint data obtaining module, the terminal point information of the NAT device that the source client for receiving third-party server X transmission is corresponding, and receive the notice initiating TCP connection to the NAT device that source client is corresponding;
Source client's side link module, for after the notice receiving the NAT device initiation TCP connection corresponding to source client, initiates TCP to the NAT device that source client is corresponding and connects;
Monitor module, connect for the TCP received from described source client, described TCP connects grouping and is forwarded by NAT device.
17. clients according to claim 16, is characterized in that,
Described client also comprises logon server module, described logon server module be used on the client line time, sets up for the first time TCP with third-party server X and is connected, with the log-on message making third-party server X record described client; Log-on message comprises the terminal point information stating client, and the NAT device that namely client is corresponding and third-party server X set up the public network IP and tcp port number that use when TCP is connected;
Described source client's side link module comprises:
Connexon module, is connected for setting up Article 2 TCP with third-party server X;
Close and notice submodule, for after setting up described Article 2 TCP and connecting, close described Article 2 TCP to connect, and connect transmission closedown message by described Article 1 TCP, connect corresponding terminal point information to make third-party server X Article 2 TCP according to described closedown Message Record;
Source reconnects submodule, after connecting at the described closedown Article 2 TCP of closedown, adopts port reuse technology to reuse the port numbers of described Article 2 TCP connection, and connects to the NAT device initiation TCP that source client is corresponding;
Ready notice submodule, after initiating TCP connection at the NAT device corresponding to source client, to third-party server X ready for sending message, after receiving described ready message, the described Article 2 TCP of record is connected corresponding terminal point information to make third-party server X and send to described source client.
18. 1 kinds, for the NAT ride through system of TCP, is characterized in that, described NAT ride through system comprises the third-party server X according to any one of claim 12-13, and the client according to any one of claim 14-17.
CN201310382234.2A 2013-08-28 2013-08-28 NAT crossing method and system for TCP, third-party server X and client Pending CN104427008A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310382234.2A CN104427008A (en) 2013-08-28 2013-08-28 NAT crossing method and system for TCP, third-party server X and client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310382234.2A CN104427008A (en) 2013-08-28 2013-08-28 NAT crossing method and system for TCP, third-party server X and client

Publications (1)

Publication Number Publication Date
CN104427008A true CN104427008A (en) 2015-03-18

Family

ID=52974910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310382234.2A Pending CN104427008A (en) 2013-08-28 2013-08-28 NAT crossing method and system for TCP, third-party server X and client

Country Status (1)

Country Link
CN (1) CN104427008A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106331198A (en) * 2015-06-29 2017-01-11 中兴通讯股份有限公司 NAT traversal method and device
CN113037890A (en) * 2021-03-20 2021-06-25 张晋 Method and system capable of ensuring penetration of symmetric NAT equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072569A1 (en) * 2004-10-04 2006-04-06 Wizzysoft Corporation Network address translation protocol for transmission control protocol connections
CN1767509A (en) * 2004-10-29 2006-05-03 北京佳讯飞鸿电气有限责任公司 Method for realizing external network user crossing NAT equipment
CN102231763A (en) * 2011-06-20 2011-11-02 北京思创银联科技股份有限公司 Sharing method based on NAT (Network Address Translation) penetration

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072569A1 (en) * 2004-10-04 2006-04-06 Wizzysoft Corporation Network address translation protocol for transmission control protocol connections
CN1767509A (en) * 2004-10-29 2006-05-03 北京佳讯飞鸿电气有限责任公司 Method for realizing external network user crossing NAT equipment
CN102231763A (en) * 2011-06-20 2011-11-02 北京思创银联科技股份有限公司 Sharing method based on NAT (Network Address Translation) penetration

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106331198A (en) * 2015-06-29 2017-01-11 中兴通讯股份有限公司 NAT traversal method and device
CN113037890A (en) * 2021-03-20 2021-06-25 张晋 Method and system capable of ensuring penetration of symmetric NAT equipment

Similar Documents

Publication Publication Date Title
US10085253B2 (en) Methods and apparatus for controlling wireless access points
US9231820B2 (en) Methods and apparatus for controlling wireless access points
US7760744B1 (en) Media path optimization for multimedia over internet protocol
CN110290093A (en) The SD-WAN network architecture and network-building method, message forwarding method
CN102546657B (en) Methods for passing through and assisting in passing through network isolation equipment in Internet protocol (IP) monitoring system, and node
CN102571524B (en) Method for traversing and assisting to transverse network isolation equipment in IP (Internet Protocol) monitoring system and node
CN107205026A (en) A kind of Point-to-Point Data Transmission method and system
CN107733808A (en) A kind of flow transmission method and device
CN102984175B (en) A kind of without IP monitoring frontend and a kind of agent apparatus
CN102546350B (en) Method and device for saving WAN (wide area network) bandwidth in IP (internet protocol) monitoring system
CN104993979A (en) Network connection monitoring method, terminal equipment and communication system
CN102571814B (en) Method and the agent equipment of xegregating unit is passed through in a kind of IP supervisory control system
CN106878259A (en) A kind of message forwarding method and device
CN102664804B (en) Method and system for achieving network bridge function of network equipment
CN104427008A (en) NAT crossing method and system for TCP, third-party server X and client
CN104168302B (en) Equipment manipulation implementation method, system and proxy gateway
CN102710644B (en) Method and device for saving bandwidth in internet protocol (IP) monitoring system
CN101465858B (en) Method for implementing private network penetration of monitoring business, network appliance and server
WO2019041332A1 (en) Method and system for optimizing transmission of acceleration network
CN102984167B (en) Traversal method for universal firewall based on Socks5 protocol
CN113286011B (en) IP address allocation method and device based on VXLAN
WO2015188706A1 (en) Data frame processing method, device and system
CN102694711B (en) Wide area network bandwidth saving method and device in IP monitoring system
CN102215135A (en) Network management crossing method and crossing system of IP voice access equipment
WO2021042446A1 (en) Layer-two tunnel switching method, system, and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20150318