CN102255898A - Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication - Google Patents
Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication Download PDFInfo
- Publication number
- CN102255898A CN102255898A CN2011101861201A CN201110186120A CN102255898A CN 102255898 A CN102255898 A CN 102255898A CN 2011101861201 A CN2011101861201 A CN 2011101861201A CN 201110186120 A CN201110186120 A CN 201110186120A CN 102255898 A CN102255898 A CN 102255898A
- Authority
- CN
- China
- Prior art keywords
- client
- server
- tcp
- udp
- mode
- 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
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention relates to a method for ensuring the stability of a large data stream by tcp/udp dual-mode communication. Upon a client end, the method includes the following steps of: (1) reading out items in the default communication mode in a program configuration file, and connecting with a server in the mode; (2) recording the current communication mode c1, tcp (Transmission Control Protocol) or udp (User Datagram Protocol); (3) counting a packet receiving rate a at a regular interval (N seconds); (4) disconnecting the current connection with the server when the packet receiving rate a is lower than an extent x; (5) recreating data connection with the server, and switching the communication mode; and (6) during the normal communication process, transmitting a heart packet to the server for ensuring the health of a link once the heart time heart-t is expired.
Description
Technical field
The present invention relates to a kind of by tcp and the stable method of the double mode switching guarantee high amount of traffic of udp.
Background technology
Fast development along with big band data exchanges such as audio frequency and video, brought the active demand that needs to improve data flow stability, common communication modes uses udp or uses tcp, this can not keep the continuity of data under some particular network environment, all external udp links have been sealed such as some intra-companies, make the software of used employing udp pattern communication to change to be configured to figure and normally move that the network operation expense of bringing thus increases and the network security risk rising.
Also have simultaneously some network environments; usually can be routed the maximum tcp connection amount of device restriction; originally the software that is to use this time tcp to connect will be cut off; if this time, software did not have to perceive the network change situation dynamically; will cause flow interruption so, more even must just can reuse by manual configuration.
Summary of the invention
At existing the problems referred to above, the invention provides a kind of by tcp and the stable method and system of the double mode switching guarantee high amount of traffic of udp, can adapt to variety of network environments, and the switching tcp or the udp communication mode of energy intelligence, thereby the transmission of keeping big data quantity all along.
The solution of the present invention is as follows:
A kind of by tcp and the stable method of the double mode switching guarantee high amount of traffic of udp, on client, may further comprise the steps:
(1) the acquiescence communication modes project in the read routine configuration file, and with this mode Connection Service device;
(2) the current communication mode c1 of record, tcp or udp;
(3) every regular hour (N second) statistics packet receiving rate a;
(4) when packet receiving rate a is lower than to a certain degree x, close being connected of current and server;
(5) establishment is connected with data in server again, switches communication mode;
(6) in the normal communication process, heart beat cycle heart_t one arrives, and sends heartbeat packet to ensure the health of link to server;
On service end, may further comprise the steps:
(1) can support tcp and udp to receive client simultaneously and be connected, but a moment can only be used a kind of connected mode;
(2) with the successful connection of client after, send the data that need to client;
(3) in certain hour (M second),, then initiatively end currently to be connected with the communication of client if do not receive the heartbeat packet of client.
Further, in above-mentioned client step:
(1) the acquiescence communication modes project in the read routine configuration file, and with this mode Connection Service device;
(1.1) in the configuration file of program, obtain the manually communication modes of setting;
(1.2) be that upd or tcp come the Connection Service device according to communication modes;
(2) the current communication mode c1 of record, TCP or UDP;
(2.1) with the server successful connection;
(2.2) received the data flow that continues that sends over from server;
(2.3) preserve current communication mode c1;
(2.4) with the server connection failure, then switch to another kind of communication modes and connect, repeat (2.1) ~ (2.4)
(2.5) if the frequency of failure surpasses 3 times, then end whole connection procedure, transmit the information to the bed boundary;
(3) every regular hour (N second) statistics packet receiving rate a;
(3.1) recv_count_1 is counted in the theoretical packet receiving that obtains in the configuration file of program manually to be provided with; The data packet number that the corresponding program of this packet receiving number obtains from certain bar link within a certain period of time;
(3.2) actual packet receiving being set, to count recv_count_2 be 0;
(3.3) whenever receive a packet, recv_count_2 adds up 1;
(3.4) timing N arrives second, then uses recv_count_2 divided by recv_count_1, obtains packet receiving rate a;
(4) when packet receiving rate a is lower than to a certain degree x (program inner setting), close being connected of current and server;
(4.1) if packet receiving rate a less than x, then closes and currently is connected with data in server;
(5) establishment is connected with data in server again, and this time connecting need be different with connection before;
(5.1), then change udp mode Connection Service device specifically into if communication mode c1 before is tcp;
(5.2), then change tcp mode Connection Service device specifically into if communication mode c1 before is udp;
(6) in the normal communication process, heart beat cycle heart_t one arrives, and sends heartbeat packet to ensure the health of link to server.
Further, in above-mentioned service end step:
(1) can support tcp and udp to receive client simultaneously and be connected, but a moment can only be used a kind of connected mode;
(1.1) when client connects by tcp, judge that whether this client has had and current being connected of using of server, has and then closes this connection, the connection of customer in response end then;
(2) with the successful connection of client after, send the data that need to client;
(2.1) server receives the request of data of client;
(2.2) server sends corresponding data to client;
(3) in certain hour (M second),, then initiatively end currently to be connected with the communication of client if do not receive the heartbeat packet of client;
(3.1) the time last_client_heart_t of the last heartbeat packet of record client;
(3.2) if current time and last_client_heart_t differ above heartbeat timeout time heart_timeout (unit second), show that then this link breaks down, then interrupt and being connected of client;
(3.3) have no progeny in the connection, wait for that connect the next time of client.
Description of drawings
Fig. 1 is the acquiescence communication modes project in the read routine configuration file, and with the flow chart of this mode Connection Service device;
Fig. 2 is the current communication mode c1 of record, the flow chart of TCP or UDP;
Fig. 3 is the flow chart every regular hour (N second) statistics packet receiving rate a;
Fig. 4 creates the flow chart that is connected with data in server again;
Fig. 5 is that server is supported tcp and udp to receive client to be connected simultaneously, but moment can only be with a kind of flow chart of connected mode;
Fig. 6 is the flow chart that the server active break is connected with client.
Embodiment
A kind of by tcp and the stable method of the double mode switching guarantee high amount of traffic of udp, on client, may further comprise the steps:
(1) the acquiescence communication modes project in the read routine configuration file, and with this mode Connection Service device;
(1.1) in the configuration file of program, obtain the manually communication modes of setting;
(1.2) be that upd or tcp come the Connection Service device according to communication modes;
(2) the current communication mode c1 of record, TCP or UDP;
(2.1) with the server successful connection;
(2.2) received the data flow that continues that sends over from server;
(2.3) preserve current communication mode c1;
(2.4) with the server connection failure, then switch to another kind of communication modes and connect, repeat (2.1) ~ (2.4)
(2.5) if the frequency of failure surpasses 3 times, then end whole connection procedure, transmit the information to the bed boundary;
(3) every regular hour (N second) statistics packet receiving rate a;
(3.1) recv_count_1 is counted in the theoretical packet receiving that obtains in the configuration file of program manually to be provided with; The data packet number that the corresponding program of this packet receiving number obtains from certain bar link within a certain period of time;
(3.2) actual packet receiving being set, to count recv_count_2 be 0;
(3.3) whenever receive a packet, recv_count_2 adds up 1;
(3.4) timing N arrives second, then uses recv_count_2 divided by recv_count_1, obtains packet receiving rate a;
(4) when packet receiving rate a is lower than to a certain degree x (program inner setting), close being connected of current and server;
(4.1) if packet receiving rate a less than x, then closes and currently is connected with data in server;
(5) establishment is connected with data in server again, and this time connecting need be different with connection before;
(5.1), then change udp mode Connection Service device specifically into if communication mode c1 before is tcp;
(5.2), then change tcp mode Connection Service device specifically into if communication mode c1 before is udp;
(6) in the normal communication process, heart beat cycle heart_t one arrives, and sends heartbeat packet to ensure the health of link to server.
On service end, may further comprise the steps:
(1) can support tcp and udp to receive client simultaneously and be connected, but a moment can only be used a kind of connected mode;
(1.1) when client connects by tcp, judge that whether this client has had and current being connected of using of server, has and then closes this connection, the connection of customer in response end then;
(2) with the successful connection of client after, send the data that need to client;
(2.1) server receives the request of data of client;
(2.2) server sends corresponding data to client;
(3) in certain hour (M second),, then initiatively end currently to be connected with the communication of client if do not receive the heartbeat packet of client;
(3.1) the time last_client_heart_t of the last heartbeat packet of record client;
(3.2) if current time and last_client_heart_t differ above heartbeat timeout time heart_timeout (unit second), show that then this link breaks down, then interrupt and being connected of client;
(3.3) have no progeny in the connection, wait for that connect the next time of client.
Specifically under the serious network environment of udp packet loss, adopt the client packet receiving rate of udp communication to have only 7.6%, and adopt above by tcp and the stable method of the double mode switching guarantee high amount of traffic of udp, it is udp that communication modes is set, setting is every packet receiving rate of 8 minutes statistics, it is 60*24*2*8 that theoretical packet receiving number is set, it is 10 seconds that heart beat cycle is set, client switches to tcp in operation after 8 minutes, packet receiving this moment rate is more than 97%, prove the effectively variation of dynamically adapting network condition of this method, avoided some special networks settings.
Claims (3)
1. one kind ensures the stable method of high amount of traffic by the double mode switching of tcp and udp, it is characterized in that, may further comprise the steps on client:
(1) the acquiescence communication modes project in the read routine configuration file, and with this mode Connection Service device;
(2) the current communication mode c1 of record, tcp or udp;
(3) every regular hour (N second) statistics packet receiving rate a;
(4) when packet receiving rate a is lower than to a certain degree x, close being connected of current and server;
(5) establishment is connected with data in server again, switches communication mode;
(6) in the normal communication process, heart beat cycle heart_t one arrives, and sends heartbeat packet to ensure the health of link to server;
On service end, may further comprise the steps:
(1) can support tcp and udp to receive client simultaneously and be connected, but a moment can only be used a kind of connected mode;
(2) with the successful connection of client after, send the data that need to client;
(3) in certain hour (M second),, then initiatively end currently to be connected with the communication of client if do not receive the heartbeat packet of client.
2. according to claim 1ly a kind ofly ensure the stable method of high amount of traffic, it is characterized in that by the double mode switching of tcp and udp, in above-mentioned client step:
(1) the acquiescence communication modes project in the read routine configuration file, and with this mode Connection Service device;
(1.1) in the configuration file of program, obtain the manually communication modes of setting;
(1.2) be that upd or tcp come the Connection Service device according to communication modes;
(2) the current communication mode c1 of record, TCP or UDP;
(2.1) with the server successful connection;
(2.2) received the data flow that continues that sends over from server;
(2.3) preserve current communication mode c1;
(2.4) with the server connection failure, then switch to another kind of communication modes and connect, repeat (2.1) ~ (2.4)
(2.5) if the frequency of failure surpasses 3 times, then end whole connection procedure, transmit the information to the bed boundary;
(3) every regular hour (N second) statistics packet receiving rate a;
(3.1) recv_count_1 is counted in the theoretical packet receiving that obtains in the configuration file of program manually to be provided with; The data packet number that the corresponding program of this packet receiving number obtains from certain bar link within a certain period of time;
(3.2) actual packet receiving being set, to count recv_count_2 be 0;
(3.3) whenever receive a packet, recv_count_2 adds up 1;
(3.4) timing N arrives second, then uses recv_count_2 divided by recv_count_1, obtains packet receiving rate a;
(4) when packet receiving rate a is lower than to a certain degree x (program inner setting), close being connected of current and server;
(4.1) if packet receiving rate a less than x, then closes and currently is connected with data in server;
(5) establishment is connected with data in server again, and this time connecting need be different with connection before;
(5.1), then change udp mode Connection Service device specifically into if communication mode c1 before is tcp;
(5.2), then change tcp mode Connection Service device specifically into if communication mode c1 before is udp;
(6) in the normal communication process, heart beat cycle heart_t one arrives, and sends heartbeat packet to ensure the health of link to server.
3. according to claim 1ly a kind ofly ensure the stable method of high amount of traffic, it is characterized in that by the double mode switching of tcp and udp, in above-mentioned service end step:
(1) can support tcp and udp to receive client simultaneously and be connected, but a moment can only be used a kind of connected mode;
(1.1) when client connects by tcp, judge that whether this client has had and current being connected of using of server, has and then closes this connection, the connection of customer in response end then;
(2) with the successful connection of client after, send the data that need to client;
(2.1) server receives the request of data of client;
(2.2) server sends corresponding data to client;
(3) in certain hour (M second),, then initiatively end currently to be connected with the communication of client if do not receive the heartbeat packet of client;
(3.1) the time last_client_heart_t of the last heartbeat packet of record client;
(3.2) if current time and last_client_heart_t differ above heartbeat timeout time heart_timeout (unit second), show that then this link breaks down, then interrupt and being connected of client;
(3.3) have no progeny in the connection, wait for that connect the next time of client.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101861201A CN102255898A (en) | 2011-07-05 | 2011-07-05 | Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101861201A CN102255898A (en) | 2011-07-05 | 2011-07-05 | Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102255898A true CN102255898A (en) | 2011-11-23 |
Family
ID=44982894
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011101861201A Pending CN102255898A (en) | 2011-07-05 | 2011-07-05 | Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102255898A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103685236A (en) * | 2013-11-21 | 2014-03-26 | 南京信息工程大学 | Method for processing data of user layer in transmission of network data of wireless sensor |
CN103986762A (en) * | 2014-05-15 | 2014-08-13 | 京信通信系统(中国)有限公司 | Process state detection method and device |
CN104283716A (en) * | 2014-10-22 | 2015-01-14 | 网易(杭州)网络有限公司 | Data transmission method, equipment and system |
CN104660627A (en) * | 2013-11-18 | 2015-05-27 | 北京北方微电子基地设备工艺研究中心有限责任公司 | Communication method and communication system for upper computer and lower computer |
CN105490729A (en) * | 2015-11-26 | 2016-04-13 | 中国航天空气动力技术研究院 | Satellite link based one-to-many data transmission system, and method |
CN106506434A (en) * | 2015-09-07 | 2017-03-15 | 华为技术有限公司 | Service data transmission method and device |
CN107592566A (en) * | 2017-09-22 | 2018-01-16 | 四川长虹电器股份有限公司 | The method of android system intelligent television communication |
CN109104408A (en) * | 2018-06-29 | 2018-12-28 | 努比亚技术有限公司 | data transmission method, mobile terminal and computer readable storage medium |
CN109818773A (en) * | 2017-11-22 | 2019-05-28 | 大唐移动通信设备有限公司 | A kind of communication means and equipment of network management and managed devices |
CN110493116A (en) * | 2018-05-14 | 2019-11-22 | 广州小鹏汽车科技有限公司 | A kind of car networking data transmission method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101056260A (en) * | 2007-05-21 | 2007-10-17 | 中南大学 | ECN mechanism-based congestion control method in the mixed network |
CN102025474A (en) * | 2010-12-30 | 2011-04-20 | 北京佳讯飞鸿电气股份有限公司 | Network data transmission method |
-
2011
- 2011-07-05 CN CN2011101861201A patent/CN102255898A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101056260A (en) * | 2007-05-21 | 2007-10-17 | 中南大学 | ECN mechanism-based congestion control method in the mixed network |
CN102025474A (en) * | 2010-12-30 | 2011-04-20 | 北京佳讯飞鸿电气股份有限公司 | Network data transmission method |
Non-Patent Citations (1)
Title |
---|
陈静等: "《一种适用于移动通信网的流媒体传输策略》", 《杭州电子科技大学学报》, vol. 30, no. 5, 31 October 2010 (2010-10-31), pages 1 - 3 * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104660627B (en) * | 2013-11-18 | 2018-08-24 | 北京北方华创微电子装备有限公司 | A kind of communication means and system of host computer and slave computer |
CN104660627A (en) * | 2013-11-18 | 2015-05-27 | 北京北方微电子基地设备工艺研究中心有限责任公司 | Communication method and communication system for upper computer and lower computer |
CN103685236A (en) * | 2013-11-21 | 2014-03-26 | 南京信息工程大学 | Method for processing data of user layer in transmission of network data of wireless sensor |
CN103986762A (en) * | 2014-05-15 | 2014-08-13 | 京信通信系统(中国)有限公司 | Process state detection method and device |
CN104283716A (en) * | 2014-10-22 | 2015-01-14 | 网易(杭州)网络有限公司 | Data transmission method, equipment and system |
CN104283716B (en) * | 2014-10-22 | 2018-01-26 | 网易(杭州)网络有限公司 | Data transmission method, equipment and system |
WO2017041569A1 (en) * | 2015-09-07 | 2017-03-16 | 华为技术有限公司 | Service data transmission method and device |
CN106506434A (en) * | 2015-09-07 | 2017-03-15 | 华为技术有限公司 | Service data transmission method and device |
CN105490729A (en) * | 2015-11-26 | 2016-04-13 | 中国航天空气动力技术研究院 | Satellite link based one-to-many data transmission system, and method |
CN105490729B (en) * | 2015-11-26 | 2018-10-09 | 中国航天空气动力技术研究院 | A kind of one-to-many data transmission system and method based on satellite link |
CN107592566A (en) * | 2017-09-22 | 2018-01-16 | 四川长虹电器股份有限公司 | The method of android system intelligent television communication |
CN109818773A (en) * | 2017-11-22 | 2019-05-28 | 大唐移动通信设备有限公司 | A kind of communication means and equipment of network management and managed devices |
CN109818773B (en) * | 2017-11-22 | 2021-03-12 | 大唐移动通信设备有限公司 | Communication method and device for network management and managed device |
CN110493116A (en) * | 2018-05-14 | 2019-11-22 | 广州小鹏汽车科技有限公司 | A kind of car networking data transmission method and device |
CN109104408A (en) * | 2018-06-29 | 2018-12-28 | 努比亚技术有限公司 | data transmission method, mobile terminal and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102255898A (en) | Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication | |
CN102223257B (en) | Heartbeat interval adjusting method, server, client terminal and communication system | |
US8867364B2 (en) | Method and apparatus for multi-homing path selection of stream control transmission protocol | |
CN102075390B (en) | Transmission state detection method and related device thereof | |
CN110943998B (en) | Signal transmission method, device, equipment and medium | |
CN100512159C (en) | Method and equipment for detecting periodically link state | |
CN105516262B (en) | Application program remote control method and system | |
US20210329528A1 (en) | Connection establishment method and related device | |
US9906412B2 (en) | Collaboration method and system in distributed resilient network interconnect system | |
CN105450779A (en) | Method for achieving connection between one household electric appliance and multiple servers | |
CN101051957B (en) | Dynamically regulating method and device for link state and bundled link state | |
CN102064605B (en) | Method for realizing mutual hot backup of electric energy acquisition systems | |
CN103795518A (en) | Method, device, and system for synchronizing port modes between devices | |
CN102882708A (en) | Operation and maintenance auditing method, device and system | |
KR100621232B1 (en) | Synchronization method and apparatus | |
CN101848165B (en) | The method recovered after controlling interrupted communication link and interface board | |
WO2011074625A1 (en) | Wireless base station system, and relay device | |
CN101729360A (en) | Method and device for setting path state | |
CN102014054A (en) | Sending method and equipment for keep-alive messages | |
CN105577811B (en) | A kind of method and apparatus of ppp state monitoring and Auto-reconnect based on communication module | |
CN112073270B (en) | Link fault detection method and device | |
EP2432167B1 (en) | Method and apparatus for implementing point to point remote loopback of ethernet | |
CN111182516B (en) | Data transmission system of BLE link | |
JP5462266B2 (en) | Mobile communication network | |
CN111198840B (en) | GOOSE and MMS common network communication method and system suitable for dual-core system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20111123 |