Nothing Special   »   [go: up one dir, main page]

CN103607311B - System and method for reestablishing TCP connection seamlessly - Google Patents

System and method for reestablishing TCP connection seamlessly Download PDF

Info

Publication number
CN103607311B
CN103607311B CN201310629375.XA CN201310629375A CN103607311B CN 103607311 B CN103607311 B CN 103607311B CN 201310629375 A CN201310629375 A CN 201310629375A CN 103607311 B CN103607311 B CN 103607311B
Authority
CN
China
Prior art keywords
tcp
original
connects
connection
newly
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.)
Active
Application number
CN201310629375.XA
Other languages
Chinese (zh)
Other versions
CN103607311A (en
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.)
Xiamen Meiya Pico Information Co Ltd
Original Assignee
Xiamen Meiya Pico Information 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 Xiamen Meiya Pico Information Co Ltd filed Critical Xiamen Meiya Pico Information Co Ltd
Priority to CN201310629375.XA priority Critical patent/CN103607311B/en
Publication of CN103607311A publication Critical patent/CN103607311A/en
Application granted granted Critical
Publication of CN103607311B publication Critical patent/CN103607311B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for reestablishing TCP connection seamlessly. The method comprises the following steps: S1, a TCP client side determines original TCP connection which needs to be reestablished, and a connection reestablishment option is added into a TCP SYN message; S2, a TCP server side finds out the original TCP connection according to the connection reestablishment option, and reestablishes new TCP connection according to connection attributes of the original TCP connection; S3, when establishment of the new TCP connection is completed, the TCP client side and the TCP server side copy data in a transmitting cache and data in a receiving cache of the original TCP connection to a transmitting cache and a receiving cache of the new TCP connection correspondingly. The invention further discloses a system for reestablishing the TCP connection seamlessly.

Description

The system and method that a kind of seamless reconstruction tcp connects
Technical field
The present invention relates to the communications field, the system and method that more particularly, to a kind of seamless reconstruction tcp connects.
Background technology
Tcp (transmission control protocol) is transport layer protocol, and in tcp/ip network, tcp is should There is provided reliable transmission channel with the application program of layer.
When situations below, application program needs to rebuild tcp connection: when 1, original tcp connects abnormal disconnection, applies journey Sequence needs to create new tcp connection;2nd, when unstable networks lead to tcp to send data failure, tcp adopts exponential backoff mechanism weight New send (when sending unsuccessfully, with exponential increase, e.g., interval time is followed successively by the time interval resending: 1 second, 2 seconds, 4 Second, 8 seconds, 16 seconds, 32 seconds), when exponential backoff mechanism leads to network recovery, tcp connect data is activation can not recover in time (with As a example the back off time of aforementioned hypothesis, if network recovered when the 16th second, due to exponential backoff mechanism, tcp data is activation needs Will by the 31st second when just can recover).
In prior art, mainly tcp is actively rebuild by application program and connect, make data transmit-receive faster recover normal.Logical Normal processing mode is: during tcp disconnecting, return back to initial interface based on application program thereon, in being forced using process Disconnected, lead to the part operation having executed and process loss.This application program actively rebuilds tcp connection, and there are the following problems: should When rebuilding tcp connection with program, not sending successful data in original tcp Connection Cache can be dropped.Therefore, application program Need to consider and solve the data loss problem leading to due to tcp connection reconstruction.
Content of the invention
When rebuilding tcp connection for solving application program in prior art, do not send successfully in original tcp Connection Cache Data can be dropped, and lead to the part operation having executed and process the technological deficiency lost, and the present invention provides a kind of seamless heavy Build the system and method for tcp connection.
One aspect of the present invention is:
There is provided a kind of method that seamless reconstruction tcp connects, including step: s1, tcp client determines what needs were rebuild Original tcp connects, and adds connection reconstruction option in tcp syn message, and described connection reconstruction option includes original tcp and connects Source ip address and source port number and purpose ip address and destination slogan;S2, tcp service end finds according to the Reconstruction Option Original tcp connects, and re-creates newly-built tcp connection according to the connection attribute that original tcp connects;S3, when newly-built tcp connect wound Build when completing, tcp client each will be corresponding with the data in order caching for original tcp linkup transmit caching with tcp service end Copy in the transmission caching and order caching that newly-built tcp connects.
Another technical solution used in the present invention is:
There is provided the system that a kind of seamless reconstruction tcp connects, including tcp client and tcp service end, described tcp client End includes the first connection reconstruction module, described tcp service end includes the second connection reconstruction module;Described first connection reconstruction module Need the original tcp being rebuild to connect for determining, and add connection reconstruction option in tcp syn message, and be used for When newly-built tcp connection establishment completes, the data in original tcp linkup transmit caching and order caching is accordingly copied to newly Build in the transmission caching and order caching of tcp connection, wherein said connection reconstruction option includes the source ip address that original tcp connects With source port number and purpose ip address and destination slogan;Described second connection reconstruction module is used for being looked for according to the Reconstruction Option Connect to original tcp, and newly-built tcp is re-created according to the connection attribute that original tcp connects and connect, and for when newly-built When tcp connection establishment completes, the data in original tcp linkup transmit caching and order caching is accordingly copied to newly-built tcp In the transmission caching and order caching that connect.
The invention has the beneficial effects as follows: when being different from the application program of prior art and rebuilding tcp and connect, original tcp connects Do not send successful data in caching can be dropped, lead to the part operation having executed and process the technological deficiency lost, The present invention provides the system and method that a kind of seamless reconstruction tcp connects, when application program needs to rebuild tcp connection, by original tcp There is no the data processing in linkup transmit and order caching, copy in newly-built tcp linkup transmit and order caching, tcp is even After connecing reconstruction, application program can continue transceiving data in newly-built tcp connection, and original tcp does not have the number processing in connecting According to losing, make application program without the concern for and solve to rebuild the tcp data loss problem that leads to of connection.
Brief description
Fig. 1 is the execution flow chart of a kind of method that seamless reconstruction tcp connects in an embodiment of the present invention;
Fig. 2 is the schematic diagram increasing the Reconstruction Option under tcp syn message options option list;
Fig. 3 is that tcp client is realized rebuilding the interaction diagrams that tcp is connected with tcp service end.
Specific embodiment
By the technology contents of the detailed description present invention, structural feature, realized purpose and effect, below in conjunction with embodiment And coordinate accompanying drawing to be explained in detail.
Refer to Fig. 1, be the execution flow chart of a kind of method that seamless reconstruction tcp connects in an embodiment of the present invention. This is seamless to rebuild the method that tcp connects and includes step:
Step s1, tcp client determines needs the original tcp being rebuild to connect, and adds even in tcp syn message Connect the Reconstruction Option, described connection reconstruction option includes source ip address and source port number and the purpose ip address that original tcp connects And destination slogan.
Refer to Fig. 2, be the schematic diagram increasing the Reconstruction Option under tcp syn message options option list.tcp Syn message is first handshake packet of three-way handshake bag, and in tcp/ip agreement, tcp agreement provides reliable Connection Service, adopts Set up a connection with three-way handshake:
Shake hands for the first time: when setting up connection, client sends syn bag (syn=j) and arrives server, and enters syn_sent State, waiting for server confirms, syn is synchronizing sequence numbering (synchronize sequence numbers).Hold for the second time Hand: server receives syn bag it is necessary to confirm the syn (ack=j+1) of client, oneself also sends a syn bag (syn=simultaneously K), i.e. syn+ack bag, now server enter syn_recv state.Third time is shaken hands: client receives the syn+ of server Ack bag, sends to server and confirms bag ack (ack=k+1), and this bag is sent, and client and server enters Established state.After completing above-mentioned three-way handshake, client and server start to transmit data.
Step s2, tcp service end finds original tcp according to the Reconstruction Option and connects, and the connection being connected according to original tcp belongs to Property re-create newly-built tcp and connect.
Step s3, when newly-built tcp connects establishment and completes, original tcp is each connected by tcp client and tcp service end Send the data in caching and order caching accordingly to copy in the transmission caching and order caching that newly-built tcp connects.
In the present embodiment, described step s1 specifically includes:
Step s11, determination need the original tcp being rebuild to connect;
The connection attribute that step s12, the original tcp of reading connect, described connection attribute includes tcp source ip address, tcp purpose Ip address, tcp source port number, tcp destination slogan, original sequence number and original confirmation number;
The sequence number that step s13, the newly-built tcp of initialization connect and confirmation number are respectively a First ray number and the first confirmation Number, then initiate newly-built tcp connection request to tcp service end.
In the present embodiment, described step s2 specifically includes:
Step s21, when receiving newly-built tcp connection request, tcp service end judge tcp syn message whether there is weight Build option;
Step s22, when judge tcp syn message there is the Reconstruction Option when, found former according to the field in the Reconstruction Option There is tcp to connect, obtain the connection attribute that this original tcp connects, connected according to the newly-built tcp of connection attribute setting that original tcp connects Connect attribute, wherein, sequence number=original sequence number -1 that newly-built tcp connects, confirmation number=original confirmation that newly-built tcp connects Number -1.
It is described in detail with reference to the method that a specific implementation step connects to above-mentioned seamless reconstruction tcp.Please join Read Fig. 3, be that tcp client is realized rebuilding the interaction diagrams that tcp is connected with tcp service end.Tcp client and tcp service end The interaction realizing rebuilding tcp connection comprises the steps:
(1) tcp client determines needs the tcp rebuilding to connect;
(2) tcp client reads the connection attribute that original tcp connects;
(3) connection attribute of the newly-built connection of tcp client initialization;
(4) tcp client initiates the request of the tcp syn with the Reconstruction Option;
(5) tcp service end carries out port snoop;
(6) tcp service end receives the request of the tcp syn with the Reconstruction Option;
(7) find original tcp according to the Reconstruction Option to connect;
(8) tcp service end reads the connection attribute that original tcp connects;
(9) tcp service end initializes the connection attribute of newly-built connection;
(10) tcp service end sends tcp syn+ack response message;
(11) tcp client receives tcp syn+ack response message;
(12) tcp client sends tcp ack response message, then respectively enters step (13) and step (15);
(13) original tcp connection data duplication is connected by tcp client to newly-built tcp;
(14) the normal transceiving data of tcp client.
(15) tcp service end receives tcp ack response message;
(16) original tcp connection data duplication is connected by tcp service end to newly-built tcp;
(17) the normal transceiving data of tcp service end.
Another aspect of the present invention provides the system that a kind of seamless reconstruction tcp connects, the side that above-mentioned seamless reconstruction tcp connects Method is applied in this system.The system of reconstruction tcp connection that this is seamless includes tcp client and tcp service end.Described tcp visitor Family end includes the first connection reconstruction module, described tcp service end includes the second connection reconstruction module.
Described first connection reconstruction module is used for determining needs the original tcp being rebuild to connect, and in tcp syn message Middle interpolation connection reconstruction option, when newly-built tcp connection establishment completes, by original tcp linkup transmit caching and order caching Data accordingly copy in the transmission caching and order caching that newly-built tcp connects, wherein, described connection reconstruction option includes Source ip address and source port number and purpose ip address and destination slogan that original tcp connects.
Described second connection reconstruction module is used for finding original tcp connection according to the Reconstruction Option, and is connected according to original tcp Connection attribute re-create newly-built tcp and connect, and for when newly-built tcp connects establishment and completes, original tcp being connected and sending out The data in caching and order caching is sent accordingly to copy in the transmission caching and order caching that newly-built tcp connects.
In the present embodiment, described first connection reconstruction module specifically includes determining module, read module, asks modulus Block, the first replication module.
Determining module is used for determining needs the original tcp being rebuild to connect.Read module is used for reading original tcp connection Connection attribute, described connection attribute includes tcp source ip address, the ip address of tcp mesh, tcp source port number, tcp destination interface Number, original sequence number and original confirmation number.Request module is used for initializing the sequence number of newly-built tcp connection and confirmation number is respectively First ray number and confirmation No. the first, then initiate newly-built tcp connection request to tcp service end.
In the present embodiment, described second connection reconstruction module specifically includes judge module, setup module, the second duplication Module.Judge module is used for, when tcp service end receives newly-built tcp connection request, judging that tcp syn message whether there is weight Build option.Setup module is used for when described judge module judges that tcp syn message has the Reconstruction Option, according in the Reconstruction Option Field find original tcp and connect, obtain the connection attribute that this original tcp connects, the connection attribute connecting according to original tcp Newly-built tcp connection attribute is set, wherein, sequence number=original sequence number -1 that newly-built tcp connects, the confirmation that newly-built tcp connects Number=original confirmation number -1.
Described first replication module and the second replication module are respectively used to when newly-built tcp connection establishment completes, by tcp visitor Data in family end and tcp service end original tcp linkup transmit caching and order caching accordingly copies to what newly-built tcp connected Send in caching and order caching.
The invention has the beneficial effects as follows: when being different from the application program of prior art and rebuilding tcp and connect, original tcp connects Do not send successful data in caching can be dropped, lead to the part operation having executed and process the technological deficiency lost, The present invention provides the system and method that a kind of seamless reconstruction tcp connects, when application program needs to rebuild tcp connection, by original tcp There is no the data processing in linkup transmit and order caching, copy in newly-built tcp linkup transmit and order caching, tcp is even After connecing reconstruction, application program can continue transceiving data in newly-built tcp connection, and original tcp does not have the number processing in connecting According to losing, make application program without the concern for and solve to rebuild the tcp data loss problem that leads to of connection.
The foregoing is only embodiments of the invention, not thereby limit the present invention the scope of the claims, every using this Equivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skills Art field, is included within the scope of the present invention.

Claims (4)

1. a kind of method that seamless reconstruction tcp connects is it is characterised in that include step:
S1, tcp client determines needs the original tcp being rebuild to connect;Read the connection attribute that original tcp connects, described Connection attribute include tcp source ip address, the ip address of tcp mesh, tcp source port number, tcp destination slogan, original sequence number and Original confirmation number;Initialize sequence number and confirmation number respectively original sequence number -1 and the original confirmation number -1 that newly-built tcp connects, Then initiate the request of the tcp with the Reconstruction Option to tcp service end, and add connection reconstruction option in tcp syn message, described Connection reconstruction option includes original tcp source ip address of tcp connection and the ip address of tcp source port number and tcp mesh and tcp Destination slogan;
S2, tcp service end finds original tcp according to the field in the Reconstruction Option and connects, and obtains the connection that this original tcp connects Attribute, arranges newly-built tcp connection attribute according to the connection attribute that original tcp connects, wherein, sequence number that newly-built tcp connects= Original sequence number -1, the confirmation number that newly-built tcp connects=original confirmation number -1;
S3, when newly-built tcp connects establishment and completes, original tcp linkup transmit is each cached by tcp client and tcp service end Accordingly copy in the transmission caching and order caching that newly-built tcp connects with the data in order caching.
2. the method that a kind of seamless reconstruction tcp according to claim 1 connects is it is characterised in that described step s2 is concrete Including:
S21, when receiving newly-built tcp connection request, tcp service end judge tcp syn message whether there is the Reconstruction Option;
S22, when judging that tcp syn message has the Reconstruction Option, original tcp is found even according to the field in the Reconstruction Option Connect, obtain the connection attribute that this original tcp connects, newly-built tcp connection attribute is arranged according to the connection attribute that original tcp connects, Wherein, sequence number=original sequence number -1 that newly-built tcp connects, the confirmation number that newly-built tcp connects=original confirmation number -1.
3. the system that a kind of seamless reconstruction tcp connects, including tcp client and tcp service end it is characterised in that described tcp Client includes the first connection reconstruction module, described tcp service end includes the second connection reconstruction module;
Described first connection reconstruction module includes:
Determining module, needs the original tcp being rebuild to connect for determining;
Read module, for reading the connection attribute that original tcp connects, described connection attribute includes tcp source ip address, tcp mesh Ip address, tcp source port number, tcp destination slogan, original sequence number and original confirmation number;
Request module, for initialize the sequence number that newly-built tcp connects and confirming number be respectively original sequence number -1 and original really The number of recognizing -1, then initiates the request of the tcp with the Reconstruction Option to tcp service end, and adds connection reconstruction choosing in tcpsyn message , described connection reconstruction option includes the tcp source ip address of original tcp connection and the ip ground of tcp source port number and tcp mesh Location and tcp destination slogan;
First replication module, for when newly-built tcp connect establishment complete when, by original for tcp client tcp linkup transmit caching and Data in order caching accordingly copies in the transmission caching and order caching that newly-built tcp connects;Described second connects weight Modeling block is used for finding original tcp connection according to the field in the Reconstruction Option, obtains the connection attribute that this original tcp connects, Newly-built tcp connection attribute is arranged according to the connection attribute that original tcp connects, wherein, sequence number=original sequence that newly-built tcp connects Row number -1, the confirmation number that newly-built tcp connects=original confirmation number -1;And it is used for when newly-built tcp connection establishment completes, will be former The data in tcp linkup transmit caching and order caching is had accordingly to copy to the transmission caching of newly-built tcp connection and receive slow In depositing.
4. the system that a kind of seamless reconstruction tcp according to claim 3 connects is it is characterised in that described second connects weight Modeling block specifically includes:
Judge module is heavy for when tcp service end receives newly-built tcp connection request, judging that tcp syn message whether there is Build option;
Setup module, for when described judge module judges that tcp syn message has the Reconstruction Option, according in the Reconstruction Option Field finds original tcp and connects, and obtains the connection attribute that this original tcp connects, is set according to the connection attribute that original tcp connects Put newly-built tcp connection attribute, wherein, sequence number=original sequence number -1 that newly-built tcp connects, the confirmation number that newly-built tcp connects =original confirmation number -1;
Second replication module, for when newly-built tcp connect establishment complete when, by original for tcp service end tcp linkup transmit caching and Data in order caching accordingly copies in the transmission caching and order caching that newly-built tcp connects.
CN201310629375.XA 2013-11-29 2013-11-29 System and method for reestablishing TCP connection seamlessly Active CN103607311B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310629375.XA CN103607311B (en) 2013-11-29 2013-11-29 System and method for reestablishing TCP connection seamlessly

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310629375.XA CN103607311B (en) 2013-11-29 2013-11-29 System and method for reestablishing TCP connection seamlessly

Publications (2)

Publication Number Publication Date
CN103607311A CN103607311A (en) 2014-02-26
CN103607311B true CN103607311B (en) 2017-01-18

Family

ID=50125512

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310629375.XA Active CN103607311B (en) 2013-11-29 2013-11-29 System and method for reestablishing TCP connection seamlessly

Country Status (1)

Country Link
CN (1) CN103607311B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107026783B (en) * 2016-01-31 2019-12-13 格尔软件股份有限公司 Quick reconnection method suitable for virtual private network
CN107172572B (en) * 2017-04-25 2018-07-31 西安梦贝智能科技有限公司 Virtual connections method based on low-power consumption bluetooth and the wireless charging agreement using this method
CN108306828A (en) * 2018-01-24 2018-07-20 广东睿江云计算股份有限公司 A kind of method and device optimizing TCP connection using congestion control data list
CN109729104B (en) * 2019-03-19 2021-08-17 北京百度网讯科技有限公司 Client source address acquisition method, device, server and computer readable medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588910A (en) * 2004-08-10 2005-03-02 毛德操 Method for directly routing of out bound moving node flow in internet
CN1965532A (en) * 2004-04-30 2007-05-16 国际商业机器公司 Method and apparatus for group communication with end-to-end reliability
CN101369973A (en) * 2008-10-20 2009-02-18 成都市华为赛门铁克科技有限公司 Method and device for conversation aging
CN101827111A (en) * 2010-05-12 2010-09-08 中兴通讯股份有限公司 TCP (Transfer Control Protocol) linking method, network system, client end and server
CN102014005A (en) * 2010-12-17 2011-04-13 天津曙光计算机产业有限公司 Method for implementing TCP connection management by using multistage memory searching mode
CN102868754A (en) * 2012-09-26 2013-01-09 北京联创信安科技有限公司 High-availability method, node device and system for achieving cluster storage

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1965532A (en) * 2004-04-30 2007-05-16 国际商业机器公司 Method and apparatus for group communication with end-to-end reliability
CN1588910A (en) * 2004-08-10 2005-03-02 毛德操 Method for directly routing of out bound moving node flow in internet
CN101369973A (en) * 2008-10-20 2009-02-18 成都市华为赛门铁克科技有限公司 Method and device for conversation aging
CN101827111A (en) * 2010-05-12 2010-09-08 中兴通讯股份有限公司 TCP (Transfer Control Protocol) linking method, network system, client end and server
CN102014005A (en) * 2010-12-17 2011-04-13 天津曙光计算机产业有限公司 Method for implementing TCP connection management by using multistage memory searching mode
CN102868754A (en) * 2012-09-26 2013-01-09 北京联创信安科技有限公司 High-availability method, node device and system for achieving cluster storage

Also Published As

Publication number Publication date
CN103607311A (en) 2014-02-26

Similar Documents

Publication Publication Date Title
US7860985B2 (en) Method for synchronizing connection state in data communication, and communication node using the same
CN101536417B (en) Method for eliminating redundant connections
WO2017219557A1 (en) Data transmission method and data transmission apparatus
CN112039884B (en) Application method of quick interconnection protocol QUIC in distributed database system
US20080159325A1 (en) System and method for tcp high availability
CN101651706A (en) Method, system and device for sending and receiving data
CN103338118B (en) A kind of communication network method of attachment and device
CN103607311B (en) System and method for reestablishing TCP connection seamlessly
CN103354560B (en) Method and system for data decomposition and synchronization
WO2021147793A1 (en) Data processing method, apparatus and system, electronic device and computer storage medium
CN101425977A (en) Air-ground data communication control system
WO2023046088A1 (en) End-to-end system solution method applied to audio and video data transmission
CN110313138A (en) High availability is realized using multiple network elements
CN105391536A (en) Communication method and device between client end and service end
CN103973414A (en) Data transmission method and device
CN105808374A (en) Snapshot processing method and associated equipment
CN105978796A (en) Message communication method and system based on unstable mobile network
WO2021057672A1 (en) Sequence number synchronization method and apparatus
CN103685398A (en) Communication connection establishment method and communication system
WO2016106780A1 (en) User data transmission method and apparatus and terminal
US9992309B2 (en) Communication device and communication method
CN107277163B (en) Device remote mapping method and device
CN103780683A (en) Method for virtual machine online migration between XIA islands
JP7128288B2 (en) Point-to-point database synchronization over transport protocol
CN105721395B (en) Data synchronous configuration method, equipment and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant