[go: up one dir, main page]

CN107911415A - Multiplex system and its method, the storage medium and terminal of TCP flow - Google Patents

Multiplex system and its method, the storage medium and terminal of TCP flow Download PDF

Info

Publication number
CN107911415A
CN107911415A CN201710984434.3A CN201710984434A CN107911415A CN 107911415 A CN107911415 A CN 107911415A CN 201710984434 A CN201710984434 A CN 201710984434A CN 107911415 A CN107911415 A CN 107911415A
Authority
CN
China
Prior art keywords
app
tcp
request
intermediate server
http
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
CN201710984434.3A
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.)
Shenzhen Onething Technologies Co Ltd
Original Assignee
Shenzhen Onething Technologies 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 Shenzhen Onething Technologies Co Ltd filed Critical Shenzhen Onething Technologies Co Ltd
Priority to CN201710984434.3A priority Critical patent/CN107911415A/en
Publication of CN107911415A publication Critical patent/CN107911415A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • 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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality

Landscapes

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

Abstract

The present invention discloses multiplex system and its method, the storage medium and terminal of TCP flow.The method includes the steps:APP, equipment are established to TCP long connections with intermediate server respectively;After APP and equipment receive the handshake request of opposite end, check local terminal parameter and send it to opposite end, and after receiving the response of shaking hands of opposite end, select a parameter set supported jointly to complete handshake procedure;Make the HTTP server address of APP requests opposite end binding;After the HTTP server Address requests that equipment receives APP transmissions, the IP ports of oneself binding are returned to;APP is received the IP ports of equipment end return, bind a local address;APP is set to initiate HTTP request toward address;The TCP mux of APP is received HTTP request, and request data is subjected to burst, encapsulation, be then sent to intermediate server;Intermediate server is set to forward the data to equipment;The demux of equipment is set to receive HTTP request from intermediate server, and by data recombination, decapsulation, then it is sent to HTTP Server.Multiple transmission demand stagings can be interleaved alternately with TCP channel by the present invention in transmitting terminal, in these requests of receiving terminal restructuring reduction.

Description

TCP流的多路复用系统及其方法、存储介质与终端Multiplexing system of TCP stream and its method, storage medium and terminal

技术领域technical field

本发明涉及一种TCP流的多路复用系统及其方法、存储介质与终端,尤其涉及一种TCP流的多路复用系统、TCP流的多路复用方法、应用所述方法的计算机可读存储介质、应用所述方法的计算机终端。The present invention relates to a multiplexing system of TCP streams and its method, storage medium and terminal, in particular to a multiplexing system of TCP streams, a multiplexing method of TCP streams, and a computer applying the method A readable storage medium and a computer terminal applying the method.

背景技术Background technique

随着私人云技术的兴起,越来越多的位于内网中的设备需要提供基于公网地址的服务接口,以方便用户随时随地访问。但是受限于NAT、防火墙等因素的制约,内网里面的设备是无法直接供外部访问的,通过引入一个位于公网的中间服务器,内网设备和用户都通过中间服务器来传递信息。为了节约服务器资源,通常设备和用户与服务器之间只维护保持一条TCP通道,当有数据传输时,串行使用该TCP通道。对于小数据量如控制类消息,是能满足使用要求的,但传输大文件时,会长时间占用通道,导致其他的数据没有机会传输,显然无法满足高并发低延迟的要求。With the rise of private cloud technology, more and more devices located in the intranet need to provide service interfaces based on public network addresses, so that users can access them anytime and anywhere. However, limited by factors such as NAT and firewalls, the devices in the intranet cannot be directly accessed by the outside. By introducing an intermediate server located in the public network, both intranet devices and users transmit information through the intermediate server. In order to save server resources, usually only one TCP channel is maintained between the device and the user and the server. When there is data transmission, the TCP channel is used serially. For small data volumes such as control messages, it can meet the usage requirements, but when transferring large files, the channel will be occupied for a long time, resulting in no opportunity for other data to be transmitted, which obviously cannot meet the requirements of high concurrency and low latency.

发明内容Contents of the invention

为解决串行传输低效的问题,本发明提供一种TCP流的多路复用系统、TCP流的多路复用方法、应用所述方法的计算机可读存储介质、应用所述方法的计算机终端,所述系统引入并发传输方法,在发送端将多个传输请求分段交替插入到TCP通道内,在接收端重组还原这些请求。In order to solve the problem of inefficient serial transmission, the present invention provides a multiplexing system for TCP streams, a multiplexing method for TCP streams, a computer-readable storage medium applying the method, and a computer applying the method The terminal, the system introduces a concurrent transmission method, inserting multiple transmission request segments alternately into the TCP channel at the sending end, and recombining and restoring these requests at the receiving end.

本发明采用以下技术方案实现:一种TCP流的多路复用系统,所述系统的网络构架包括APP、设备以及作为所述APP与所述设备之间的通信桥梁的中间服务器;其中,The present invention is realized by the following technical solutions: a multiplexing system of TCP streams, the network framework of the system includes APP, equipment, and an intermediate server as a communication bridge between the APP and the equipment; wherein,

所述App与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;The App establishes a long TCP connection with the intermediate server, and sends a handshake request to the opposite end to negotiate parameter information;

所述设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;The device establishes a TCP long connection with the intermediate server, and sends a handshake request to the opposite end to negotiate parameter information;

所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

所述App请求对端绑定的HTTP服务器地址;The App requests the HTTP server address bound to the peer;

所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

所述App收到所述设备返回的IP端口,绑定一个本地地址;The App receives the IP port returned by the device and binds a local address;

所述App往与本地地址相对应的链接网址的地址发起HTTP请求;The App initiates an HTTP request to the address of the link URL corresponding to the local address;

所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App receives the HTTP request, fragments and encapsulates the request data, and then sends it to the intermediate server;

所述中间服务器将数据转发给所述设备;the intermediate server forwards data to the device;

所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。The demux of the device receives the HTTP request from the intermediate server, reassembles and decapsulates the data, and then sends the data to the HTTP Server.

作为上述方案的进一步改进,所述App集成TCP多路复用与解复用器,通过TCP与所述中间服务器保持长连接。As a further improvement of the above solution, the App integrates a TCP multiplexer and demultiplexer, and maintains a long connection with the intermediate server through TCP.

作为上述方案的进一步改进,所述App主动发起HTTP请求,获取所述设备的信息或者从所述设备拉取文件。As a further improvement of the above solution, the App actively initiates an HTTP request to acquire information of the device or pull a file from the device.

作为上述方案的进一步改进,所述设备集成TCP多路复用与解复用器,通过TCP与所述中间服务器保持长连接。As a further improvement of the above solution, the device integrates a TCP multiplexer and demultiplexer, and maintains a long connection with the intermediate server through TCP.

作为上述方案的进一步改进,所述设备提供HTTP Server,供所述App使用。As a further improvement of the above solution, the device provides an HTTP Server for use by the App.

作为上述方案的进一步改进,所述中间服务器分别于所述App和所述设备建立TCP连接,将所述App和所述设备发送过来的数据透传给对端。As a further improvement of the above solution, the intermediate server respectively establishes a TCP connection with the App and the device, and transparently transmits the data sent by the App and the device to the opposite end.

本发明还提供一种TCP流的多路复用方法,所述方法应用于一个TCP流的多路复用系统中,所述TCP流的多路复用系统的网络构架包括APP、设备、以及作为所述APP与所述设备之间的通信桥梁的中间服务器;所述TCP流的多路复用方法包括以下步骤:The present invention also provides a method for multiplexing TCP streams, the method is applied in a multiplexing system for TCP streams, and the network framework of the multiplexing system for TCP streams includes APP, equipment, and As an intermediate server of the communication bridge between the APP and the device; the multiplexing method of the TCP flow comprises the following steps:

将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

作为上述方案的进一步改进,所述TCP流的多路复用系统为上述任意的TCP流的多路复用系统,TCP mux接收来自HTTP Client的请求,然后复用到一个单一的TCP通道,将数据发完所述中间服务器,TCP demux从所述中间服务器接收数据,将其解复用,然后发送给HTTP Server。As a further improvement of the above scheme, the multiplexing system of the TCP stream is the multiplexing system of any of the above TCP streams, and the TCP mux receives the request from the HTTP Client, and then multiplexes it into a single TCP channel, and the After the data is sent to the intermediate server, the TCP demux receives the data from the intermediate server, demultiplexes it, and then sends it to the HTTP Server.

本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现以下步骤:The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented:

将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

本发明还提供一种计算机终端,其包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序;所述处理器执行所述程序时实现以下步骤:The present invention also provides a computer terminal, which includes a memory, a processor, and a computer program stored on the memory and operable on the processor; when the processor executes the program, the following steps are implemented:

将App与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the App and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device, and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

本发明能解决串行传输低效的问题,通过引入并发传输方法,在发送端将多个传输请求分段交替插入到TCP通道内,在接收端重组还原这些请求。The invention can solve the problem of inefficient serial transmission. By introducing a concurrent transmission method, a plurality of transmission request segments are alternately inserted into the TCP channel at the sending end, and the requests are reassembled and restored at the receiving end.

附图说明Description of drawings

图1为本发明实施例1的TCP流的多路复用系统的网络构架图。FIG. 1 is a network architecture diagram of a TCP stream multiplexing system according to Embodiment 1 of the present invention.

图2为图1中TCP流的多路复用系统内部的功能构架图。FIG. 2 is a functional framework diagram inside the multiplexing system of the TCP stream in FIG. 1 .

具体实施方式Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

实施例1Example 1

如图1所示,本发明的TCP流的多路复用系统,其网络构架包括APP、设备以及作为APP与设备之间的通信桥梁的中间服务器。TCP为Transmission Control Protocol的简写,中文为传输控制协议。As shown in FIG. 1 , the network framework of the multiplexing system of TCP streams of the present invention includes APP, equipment and an intermediate server as a communication bridge between APP and equipment. TCP is the abbreviation of Transmission Control Protocol, and Chinese is Transmission Control Protocol.

请结合图2,App集成TCP多路复用与解复用器,通过TCP与中间服务器保持长连接。App主动发起HTTP请求,获取设备的信息或者从设备拉取文件。Please combine with Figure 2, the app integrates TCP multiplexer and demultiplexer, and maintains a long connection with the intermediate server through TCP. The app actively initiates an HTTP request to obtain device information or pull files from the device.

设备集成TCP多路复用与解复用器,通过TCP与中间服务器保持长连接。设备提供HTTP Server,供App使用。The device integrates a TCP multiplexer and demultiplexer, and maintains a long connection with the intermediate server through TCP. The device provides HTTP Server for App to use.

中间服务器分别于App和设备建立TCP连接,将App和设备发送过来的数据透传给对端。The intermediate server establishes a TCP connection with the App and the device respectively, and transparently transmits the data sent by the App and the device to the opposite end.

TCP mux相当于TCP Server,接收来自HTTP Client的请求,然后复用到一个单一的TCP通道,将数据发完中间服务器。TCP demux从中间服务器接收数据,将其解复用,然后发送给HTTP Server。其中,mux即多路复用,HTTP Client=HyperText Transfer ProtocolClient,意思为超文本传输协议,demux意思为解复用器,HTTP Server意思为网页服务器,TCP mux相当于TCP Server(服务器),TCP mux is equivalent to TCP Server, which receives requests from HTTP Clients, then multiplexes them into a single TCP channel, and sends the data to the intermediate server. The TCP demux receives data from the intermediate server, demultiplexes it, and sends it to the HTTP Server. Wherein, mux is multiplexing, HTTP Client=HyperText Transfer ProtocolClient, means hypertext transfer protocol, demux means demultiplexer, HTTP Server means web server, TCP mux is equivalent to TCP Server (server),

TCP流的多路复用系统在运行流程时,采用以下步骤。The multiplexing system for TCP streams uses the following steps when running the process.

S201,App与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息。S201, the App establishes a TCP persistent connection with the intermediate server, and sends a handshake request to the peer end to negotiate parameter information.

S202,设备与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息。S202, the device establishes a TCP persistent connection with the intermediate server, and sends a handshake request to the peer end to negotiate parameter information.

S203,App和设备收到对端的握手请求后,检查本端参数,并将其发送给对端。S203. After receiving the handshake request from the opposite end, the App and the device check the local parameters and send them to the opposite end.

S204,App和设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程。S204. After receiving the handshake response from the opposite end, the App and the device check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process.

S205,App请求对端绑定的HTTP服务器地址。S205, the App requests the HTTP server address bound to the peer.

S206,设备收到App发送的HTTP服务器地址请求后,返回自己绑定的IP端口(IP,Port)。S206. After receiving the HTTP server address request sent by the App, the device returns the IP port (IP, Port) bound to itself.

S207,App收到设备返回的(IP,Port),绑定一个本地地址,如本地地址:127.0.0.1:port2。S207, the App receives the (IP, Port) returned by the device, and binds a local address, such as the local address: 127.0.0.1:port2.

S208,APP往与本地地址相对应的链接网址的地址发起HTTP请求,如往http://127.0.0.1:port2的地址发起HTTP请求。S208, the APP initiates an HTTP request to the address of the link URL corresponding to the local address, for example, initiates an HTTP request to the address of http://127.0.0.1:port2.

S209,App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往中间服务器。S209, the TCP mux of the App receives the HTTP request, fragments and encapsulates the request data, and then sends it to the intermediate server.

S210,中间服务器将数据转发给设备。S210, the intermediate server forwards the data to the device.

S211,设备的demux从中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。S211. The demux of the device receives the HTTP request from the intermediate server, reassembles and decapsulates the data, and then sends the data to the HTTP Server.

实施例2Example 2

实施例2提供了一种TCP流的多路复用方法,所述方法应用于一个TCP流的多路复用系统中,如实施例1中描述的这个TCP流的多路复用系统。Embodiment 2 provides a method for multiplexing TCP streams, and the method is applied to a multiplexing system for TCP streams, such as the multiplexing system for TCP streams described in Embodiment 1.

所述TCP流的多路复用方法包括以下步骤:The multiplexing method of described TCP stream comprises the following steps:

将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

实施例3Example 3

实施例3提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现以下步骤。Embodiment 3 provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented.

将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

实施例4Example 4

实施例4提供了一种计算机终端,其包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序。Embodiment 4 provides a computer terminal, which includes a memory, a processor, and a computer program stored in the memory and operable on the processor.

所述处理器执行所述程序时实现以下步骤:When the processor executes the program, the following steps are implemented:

将App与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the App and the intermediate server, and send a handshake request to the peer to negotiate parameter information;

将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information;

在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end;

在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process;

使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer;

在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself;

使所述App收到所述设备返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device, and bind a local address;

使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address;

使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server;

使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device;

使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.

Claims (10)

1.一种TCP流的多路复用系统,所述系统的网络构架包括APP、设备以及作为所述APP与所述设备之间的通信桥梁的中间服务器;其特征在于:1. a multiplexing system of TCP flow, the network framework of described system comprises APP, equipment and the intermediate server as the communication bridge between described APP and described equipment; It is characterized in that: 所述App与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;The App establishes a long TCP connection with the intermediate server, and sends a handshake request to the opposite end to negotiate parameter information; 所述设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;The device establishes a TCP long connection with the intermediate server, and sends a handshake request to the opposite end to negotiate parameter information; 所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end; 所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process; 所述App请求对端绑定的HTTP服务器地址;The App requests the HTTP server address bound to the peer; 所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself; 所述App收到所述设备返回的IP端口,绑定一个本地地址;The App receives the IP port returned by the device and binds a local address; 所述App往与本地地址相对应的链接网址的地址发起HTTP请求;The App initiates an HTTP request to the address of the link URL corresponding to the local address; 所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App receives the HTTP request, fragments and encapsulates the request data, and then sends it to the intermediate server; 所述中间服务器将数据转发给所述设备;the intermediate server forwards data to the device; 所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。The demux of the device receives the HTTP request from the intermediate server, reassembles and decapsulates the data, and then sends the data to the HTTP Server. 2.如权利要求1所述的TCP流的多路复用系统,其特征在于:所述App集成TCP多路复用与解复用器,通过TCP与所述中间服务器保持长连接。2. The multiplexing system of TCP streams as claimed in claim 1, characterized in that: the App integrates a TCP multiplexing and demultiplexing device, and maintains a long connection with the intermediate server through TCP. 3.如权利要求1所述的TCP流的多路复用系统,其特征在于:所述App主动发起HTTP请求,获取所述设备的信息或者从所述设备拉取文件。3. The multiplexing system of TCP streams according to claim 1, wherein the App actively initiates an HTTP request to acquire information of the device or pull files from the device. 4.如权利要求1所述的TCP流的多路复用系统,其特征在于:所述设备集成TCP多路复用与解复用器,通过TCP与所述中间服务器保持长连接。4. The multiplexing system of TCP streams as claimed in claim 1, characterized in that: the device integrates a TCP multiplexing and demultiplexing device, and maintains a long connection with the intermediate server through TCP. 5.如权利要求1所述的TCP流的多路复用系统,其特征在于:所述设备提供HTTPServer,供所述App使用。5. The multiplexing system of TCP streams according to claim 1, characterized in that: said device provides HTTP Server for use by said App. 6.如权利要求1所述的TCP流的多路复用系统,其特征在于:所述中间服务器分别于所述App和所述设备建立TCP连接,将所述App和所述设备发送过来的数据透传给对端。6. The multiplexing system of TCP streams as claimed in claim 1, characterized in that: the intermediate server establishes TCP connections with the App and the device respectively, and sends the App and the device The data is transparently transmitted to the peer. 7.一种TCP流的多路复用方法,所述方法应用于一个TCP流的多路复用系统中,所述TCP流的多路复用系统的网络构架包括APP、设备、以及作为所述APP与所述设备之间的通信桥梁的中间服务器;其特征在于:所述TCP流的多路复用方法包括以下步骤:7. A multiplexing method of a TCP flow, said method is applied in a multiplexing system of a TCP flow, and the network framework of the multiplexing system of said TCP flow includes APP, equipment, and as all An intermediate server of the communication bridge between the APP and the device; it is characterized in that: the multiplexing method of the TCP flow comprises the following steps: 将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information; 将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information; 在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end; 在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process; 使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer; 在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself; 使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address; 使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address; 使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server; 使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device; 使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server. 8.如权利要求7所述的TCP流的多路复用方法,其特征在于:所述TCP流的多路复用系统为如权利要求1至6中任意一项所述的TCP流的多路复用系统,TCP mux接收来自HTTPClient的请求,然后复用到一个单一的TCP通道,将数据发完所述中间服务器,TCP demux从所述中间服务器接收数据,将其解复用,然后发送给HTTP Server。8. the multiplexing method of TCP flow as claimed in claim 7 is characterized in that: the multiplexing system of described TCP flow is the multiplexing of TCP flow as described in any one in claim 1 to 6. Multiplexing system, TCP mux receives requests from HTTPClient, then multiplexes them to a single TCP channel, sends the data to the intermediate server, TCP demux receives data from the intermediate server, demultiplexes it, and then sends to the HTTP Server. 9.一种计算机可读存储介质,其上存储有计算机程序,其特征在于:所述程序被处理器执行时实现以下步骤:9. A computer-readable storage medium, on which a computer program is stored, characterized in that: when the program is executed by a processor, the following steps are implemented: 将APP与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the APP and the intermediate server, and send a handshake request to the peer to negotiate parameter information; 将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information; 在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end; 在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process; 使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer; 在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself; 使所述App收到所述设备端返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device and bind a local address; 使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address; 使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server; 使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device; 使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server. 10.一种计算机终端,其包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序;其特征在于:所述处理器执行所述程序时实现以下步骤:10. A computer terminal, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor; it is characterized in that: the processor implements the following steps when executing the program: 将App与中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the App and the intermediate server, and send a handshake request to the peer to negotiate parameter information; 将设备与所述中间服务器建立TCP长连接,并向对端发出握手请求,协商参数信息;Establish a TCP long connection between the device and the intermediate server, and send a handshake request to the opposite end to negotiate parameter information; 在所述App和所述设备收到对端的握手请求后,检查本端参数,并将其发送给对端;After the App and the device receive the handshake request from the opposite end, check the local parameters and send them to the opposite end; 在所述App和所述设备收到对端的握手应答后,检查本端参数,并选择一个共同支持的参数集,完成握手过程;After the App and the device receive the handshake response from the opposite end, check the parameters of the local end, and select a commonly supported parameter set to complete the handshake process; 使所述App请求对端绑定的HTTP服务器地址;make the App request the HTTP server address bound to the peer; 在所述设备收到所述App发送的HTTP服务器地址请求后,返回自己绑定的IP端口;After the device receives the HTTP server address request sent by the App, it returns the IP port bound to itself; 使所述App收到所述设备返回的IP端口,绑定一个本地地址;Make the App receive the IP port returned by the device, and bind a local address; 使所述App往与本地地址相对应的链接网址的地址发起HTTP请求;Make the App initiate an HTTP request to the address of the link URL corresponding to the local address; 使所述App的TCP mux接收HTTP请求,并将请求数据进行分片、封装,然后发往所述中间服务器;The TCP mux of the App is made to receive the HTTP request, and the request data is fragmented and encapsulated, and then sent to the intermediate server; 使所述中间服务器将数据转发给所述设备;causing the intermediate server to forward data to the device; 使所述设备的demux从所述中间服务器接收HTTP请求,并将数据重组、解封装,然后发往HTTP Server。Make the demux of the device receive the HTTP request from the intermediate server, reassemble and decapsulate the data, and then send the data to the HTTP Server.
CN201710984434.3A 2017-10-20 2017-10-20 Multiplex system and its method, the storage medium and terminal of TCP flow Pending CN107911415A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710984434.3A CN107911415A (en) 2017-10-20 2017-10-20 Multiplex system and its method, the storage medium and terminal of TCP flow

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710984434.3A CN107911415A (en) 2017-10-20 2017-10-20 Multiplex system and its method, the storage medium and terminal of TCP flow

Publications (1)

Publication Number Publication Date
CN107911415A true CN107911415A (en) 2018-04-13

Family

ID=61841625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710984434.3A Pending CN107911415A (en) 2017-10-20 2017-10-20 Multiplex system and its method, the storage medium and terminal of TCP flow

Country Status (1)

Country Link
CN (1) CN107911415A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020056850A1 (en) * 2018-09-18 2020-03-26 网宿科技股份有限公司 Data request method based on http protocol, and server
CN111367650A (en) * 2018-12-26 2020-07-03 浙江大学 A method, device and system for processing input and output streams

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1960340A (en) * 2006-09-21 2007-05-09 华为技术有限公司 Iub interface data transmission method and system in mobile communication network
CN102325197A (en) * 2011-05-23 2012-01-18 杭州华三通信技术有限公司 Method for communication between intranet equipment and internet equipment and network address transformation equipment
CN105743812A (en) * 2014-12-26 2016-07-06 英特尔公司 Multiplexing many client streams over a single connection
CN106230984A (en) * 2016-09-12 2016-12-14 深圳市彬讯科技有限公司 A kind of method that the Netty of employing framework realizes web service passage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1960340A (en) * 2006-09-21 2007-05-09 华为技术有限公司 Iub interface data transmission method and system in mobile communication network
CN102325197A (en) * 2011-05-23 2012-01-18 杭州华三通信技术有限公司 Method for communication between intranet equipment and internet equipment and network address transformation equipment
CN105743812A (en) * 2014-12-26 2016-07-06 英特尔公司 Multiplexing many client streams over a single connection
CN106230984A (en) * 2016-09-12 2016-12-14 深圳市彬讯科技有限公司 A kind of method that the Netty of employing framework realizes web service passage

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈义平、李小平: "《计算机网络技术》", 31 July 1996 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020056850A1 (en) * 2018-09-18 2020-03-26 网宿科技股份有限公司 Data request method based on http protocol, and server
US11330035B2 (en) 2018-09-18 2022-05-10 Wangsu Science & Technology Co., Ltd. Method and server for HTTP protocol-based data request
CN111367650A (en) * 2018-12-26 2020-07-03 浙江大学 A method, device and system for processing input and output streams
CN111367650B (en) * 2018-12-26 2023-11-21 浙江大学 An input and output stream processing method, device and system

Similar Documents

Publication Publication Date Title
EP2854360B1 (en) Method for connecting a first host and a second host within at least one communication network through a relay module, corresponding relay module.
EP3186930B1 (en) Relay optimization using software defined networking
EP1892887B1 (en) Communication method between communication devices and communication apparatus
EP2469792B1 (en) Data transmission system and method using relay server
EP2449749B1 (en) Method and apparatus for relaying packets
WO2016155300A1 (en) Remote control system and remote control method for wireless terminal device
CN101262478A (en) Method and device for penetrating NAT
CN101136929B (en) Internet small computer system interface data transmission method and apparatus
US20150127837A1 (en) Relay apparatus and data transfer method
CN114501593B (en) Network slice access method, device, system and storage medium
CN104836863A (en) System and method for realizing TCP reverse port mapping
CN103379182A (en) Data transmission method and client sides
JP7502484B2 (en) Network access method, media gateway, electronic device and storage medium
CN103905510A (en) Processing method and background server for data package
CN109257620B (en) Network live broadcast method and system based on multipath transmission
CN110417632B (en) Network communication method, system and server
CN107911415A (en) Multiplex system and its method, the storage medium and terminal of TCP flow
CN111711705A (en) Method and device for realizing network connection based on bidirectional NAT (network Address translation) by proxy node
WO2022001639A1 (en) Communication method, mobile device and routing device
CN113225256B (en) A routing method, device, equipment and storage medium
CN104702565A (en) Media resource sharing method, sharing server and sharing system
CN102291402B (en) Method, device and system for passing through private network
CN113542395B (en) Message processing method and message processing system
CN106657039B (en) Portal page acquisition method, wireless AP and Portal server
EP3044929B1 (en) A mobile-device based proxy for browser-originated procedures

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for 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: 20180413