CN116405546A - Data pushing method and terminal - Google Patents

Data pushing method and terminal Download PDF

Info

Publication number
CN116405546A
CN116405546A CN202310176171.9A CN202310176171A CN116405546A CN 116405546 A CN116405546 A CN 116405546A CN 202310176171 A CN202310176171 A CN 202310176171A CN 116405546 A CN116405546 A CN 116405546A
Authority
CN
China
Prior art keywords
packet
data
check
missing
push
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
CN202310176171.9A
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.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology 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 Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN202310176171.9A priority Critical patent/CN116405546A/en
Publication of CN116405546A publication Critical patent/CN116405546A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a data pushing method and a terminal, which are used for receiving a data pushing request of a client, sending a data packet based on the data pushing request and counting packet loss ratio, disassembling the data packet and generating a check packet when the packet loss ratio is larger than a preset ratio, obtaining a data pushing packet according to the data packet and the check packet, and sending the data pushing packet to the client; after receiving the data push packet, the client requests the missing data of the packet type with less missing quantity again according to the missing quantity of the data packet and the check packet. Therefore, under the unstable scene of the network, the packet type required by the request can be selected according to the loss condition of the data packet and the check packet, and the minimum data is requested in the secondary request, so that the delay of the message is reduced, and the pushing efficiency of the message is improved.

Description

Data pushing method and terminal
Technical Field
The present invention relates to the field of data pushing technologies, and in particular, to a data pushing method and a terminal.
Background
At present, more message pushing applications exist, and various applications can integrate message pushing channels of the applications or third parties, and send and receive pushing messages through the message pushing channels. Because the network of the mobile terminal is not particularly stable, under the condition that the network is unstable, the possibility of packet loss may exist for message transmission, and at this time, message pushing is unsuccessful, and the message needs to be issued again.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the data pushing method and the terminal can improve the data pushing efficiency in the scene of unstable network.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method of data pushing, comprising the steps of:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
In order to solve the technical problems, the invention adopts another technical scheme that:
a terminal for data pushing comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
The invention has the beneficial effects that: receiving a data pushing request of a client, transmitting a data packet based on the data pushing request, counting a packet loss ratio, disassembling the data packet and generating a check packet when the packet loss ratio is larger than a preset ratio, obtaining a data pushing packet according to the data packet and the check packet, and transmitting the data pushing packet to the client; after receiving the data push packet, the client requests the missing data of the packet type with less missing quantity again according to the missing quantity of the data packet and the check packet. Therefore, under the unstable scene of the network, the packet type required by the request can be selected according to the loss condition of the data packet and the check packet, and the minimum data is requested in the secondary request, so that the delay of the message is reduced, and the pushing efficiency of the message is improved.
Drawings
FIG. 1 is a flow chart of a method for pushing data according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a terminal for data push according to an embodiment of the present invention;
description of the reference numerals:
1. a terminal for pushing data; 2. a memory; 3. a processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a data pushing method, including the steps of:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
From the above description, the beneficial effects of the invention are as follows: receiving a data pushing request of a client, transmitting a data packet based on the data pushing request, counting a packet loss ratio, disassembling the data packet and generating a check packet when the packet loss ratio is larger than a preset ratio, obtaining a data pushing packet according to the data packet and the check packet, and transmitting the data pushing packet to the client; after receiving the data push packet, the client requests the missing data of the packet type with less missing quantity again according to the missing quantity of the data packet and the check packet. Therefore, under the unstable scene of the network, the packet type required by the request can be selected according to the loss condition of the data packet and the check packet, and the minimum data is requested in the secondary request, so that the delay of the message is reduced, and the pushing efficiency of the message is improved.
Further, sending a data packet according to the data push request, and counting packet loss ratio of the long connection includes:
and sending a data packet according to the data push request, monitoring each heartbeat packet of the long connection and the sent data packet, and counting the packet loss ratio of each long connection in unit time.
From the above description, it can be seen that whether the current network is stable is determined according to the packet loss conditions of the heartbeat packet and the data packet, so that the accuracy of confirming the network condition can be improved.
Further, generating a check packet from the data packet includes:
and generating a check packet by using a redundancy check method for the disassembled data packet.
As can be seen from the above description, the redundancy check is used to generate the check packet, so that the check packet can be conveniently and reversely parsed, and the client can directly obtain the requested information based on the check packet.
Further, after receiving the data push packet, the client requests missing data of a packet type with a small missing number according to the missing number of the data packet and the check packet in the data push packet, where the missing data includes:
and after receiving the data push packet, the client judges whether a packet loss condition exists, if not, ignores the check packet, if so, reversely analyzes the transmitted data from the check packet when the check packet is complete, and when the check packet is missing, requests the data missing from the check packet if the missing quantity of the data packet is greater than the missing quantity of the check packet, and if the missing quantity of the data packet is less than or equal to the missing quantity of the check packet, requests the data missing from the data packet.
As can be seen from the above description, it is possible to determine whether to retransmit the missing data packet or the missing check packet by a program, and select a smaller number of missing packets for transmission. In a normal manner, all missing packets are sent in a full-complement manner, which causes additional useless packet transmission, causes IO resource occupation and increases time consumption.
Further, adding the check packet to the data packet to obtain a data push packet includes:
after the check packet is added to the data packet, numbering is carried out according to the sequence of the data packet and the check packet;
after receiving the data push packet, the client judges whether a packet loss condition exists or not, including:
and after receiving the data push packet, the client determines the packet loss condition and the packet loss number according to the number and the number of the data packet and the check packet in the data push packet.
According to the description, the data packets and the check packets in the data pushing packets are numbered in sequence, so that the subsequent judgment of packet loss conditions and subsequent re-request of missing packets are facilitated, and the data pushing efficiency is improved.
Referring to fig. 2, another embodiment of the present invention provides a terminal for data push, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
As can be seen from the above description, receiving a data push request of a client, transmitting a data packet based on the data push request and counting a packet loss ratio, when the packet loss ratio is greater than a preset ratio, disassembling the data packet and generating a check packet, obtaining a data push packet according to the data packet and the check packet, and transmitting the data push packet to the client; after receiving the data push packet, the client requests the missing data of the packet type with less missing quantity again according to the missing quantity of the data packet and the check packet. Therefore, under the unstable scene of the network, the packet type required by the request can be selected according to the loss condition of the data packet and the check packet, and the minimum data is requested in the secondary request, so that the delay of the message is reduced, and the pushing efficiency of the message is improved.
Further, sending a data packet according to the data push request, and counting packet loss ratio of the long connection includes:
and sending a data packet according to the data push request, monitoring each heartbeat packet of the long connection and the sent data packet, and counting the packet loss ratio of each long connection in unit time.
From the above description, it can be seen that whether the current network is stable is determined according to the packet loss conditions of the heartbeat packet and the data packet, so that the accuracy of confirming the network condition can be improved.
Further, generating a check packet from the data packet includes:
and generating a check packet by using a redundancy check method for the disassembled data packet.
As can be seen from the above description, the redundancy check is used to generate the check packet, so that the check packet can be conveniently and reversely parsed, and the client can directly obtain the requested information based on the check packet.
Further, after receiving the data push packet, the client requests missing data of a packet type with a small missing number according to the missing number of the data packet and the check packet in the data push packet, where the missing data includes:
and after receiving the data push packet, the client judges whether a packet loss condition exists, if not, ignores the check packet, if so, reversely analyzes the transmitted data from the check packet when the check packet is complete, and when the check packet is missing, requests the data missing from the check packet if the missing quantity of the data packet is greater than the missing quantity of the check packet, and if the missing quantity of the data packet is less than or equal to the missing quantity of the check packet, requests the data missing from the data packet.
As can be seen from the above description, it is possible to determine whether to retransmit the missing data packet or the missing check packet by a program, and select a smaller number of missing packets for transmission. In a normal manner, all missing packets are sent in a full-complement manner, which causes additional useless packet transmission, causes IO resource occupation and increases time consumption.
Further, adding the check packet to the data packet to obtain a data push packet includes:
after the check packet is added to the data packet, numbering is carried out according to the sequence of the data packet and the check packet;
after receiving the data push packet, the client judges whether a packet loss condition exists or not, including:
and after receiving the data push packet, the client determines the packet loss condition and the packet loss number according to the number and the number of the data packet and the check packet in the data push packet.
According to the description, the data packets and the check packets in the data pushing packets are numbered in sequence, so that the subsequent judgment of packet loss conditions and subsequent re-request of missing packets are facilitated, and the data pushing efficiency is improved.
The data pushing method and the terminal are suitable for retransmitting the missing message under the condition of unstable network so as to improve the data pushing efficiency, and are described by a specific implementation mode:
example 1
Referring to fig. 1, a method for pushing data includes the steps of:
s1, receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection.
And sending a data packet according to the data push request, monitoring each heartbeat packet of the long connection and the sent data packet, and counting the packet loss ratio of each long connection in unit time.
Specifically, the heartbeat packets and packets sent by the message are monitored and counted. And counting the packet loss condition of each long connection in unit time. At this time, each long connection has its own independent timing task statistics thread, and its own packet loss ratio is counted.
S2, if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet.
When the packet loss ratio does not reach the preset threshold, the processing is not performed, and when the packet loss ratio exceeds the preset threshold, corresponding information is written into the local cache, so that the subsequent program is convenient to use.
Specifically, assuming that the preset packet loss ratio is 20%, when the packet loss ratio within a unit time does not reach 20%, the data packet is still sent to the client. When the packet loss rate exceeds 20%, disassembling the transmitted data packet before transmitting the new message, generating a check packet by adopting a redundancy check algorithm, adding the check packet after the data packet, numbering according to the sequence of the data packet and the check packet to generate a data push packet, and transmitting the data push packet to the client.
And S3, sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
After receiving the data push packet, the client judges whether a packet loss condition exists according to the number and the serial number of the data packet and the check packet in the data push packet, if not, ignores the check packet, if yes, reversely analyzes the transmitted data from the check packet when the check packet is complete, and when the check packet is missing, requests the missing data of the check packet if the missing number of the data packet is greater than the missing number of the check packet, and if the missing number of the data packet is less than or equal to the missing number of the check packet, requests the missing data of the data packet.
Specifically, in this embodiment, a whole batch of complete data push packets is of the packet type. I.e. normal packet type, and check packet type. Because each batch of data push packets are sequentially numbered, whether the packets are in shortage can be known according to the deficiency of the numbers. In practice, we can know the number of missing packets of normal data packets and the number of missing check packets. For example, a whole batch of data push packets is 30 in total, 20 data packets are represented as normal data packets, 10 data packets are check packets, when the network is unstable, the data packets are missing 4 data packets, the check packets are missing 8 data packets, and at the moment, only the missing data packets of 4 data packets need to be reissued again; if the number of missing data packets is 8 and the number of check packets is 2, the analysis of the complete data packets can be realized obviously by only supplementing 2 check packets. In a normal manner, all missing packets are sent in a full-complement manner, which causes additional useless packet transmission, causes IO resource occupation and increases time consumption.
Example two
Referring to fig. 2, a terminal 1 for data pushing includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements the steps of a method for data pushing according to the first embodiment when executing the computer program.
In summary, the method and the terminal for pushing data provided by the invention receive a data pushing request of a client, send a data packet based on the data pushing request and count a packet loss ratio, disassemble the data packet and generate a check packet when the packet loss ratio is greater than a preset ratio, obtain a data pushing packet according to the data packet and the check packet, and send the data pushing packet to the client; after receiving the data push packet, the client requests the missing data of the packet type with less missing quantity again according to the missing quantity of the data packet and the check packet. Therefore, under the unstable scene of the network, the packet type required by the request can be selected according to the loss condition of the data packet and the check packet, and the minimum data is requested in the secondary request, so that the delay of the message is reduced, and the pushing efficiency of the message is improved.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (10)

1. A method of data pushing, comprising the steps of:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
2. The method of claim 1, wherein sending data packets according to the data push request, and counting packet loss rates of long connections comprises:
and sending a data packet according to the data push request, monitoring each heartbeat packet of the long connection and the sent data packet, and counting the packet loss ratio of each long connection in unit time.
3. The method of claim 1, wherein generating a check packet from the data packet comprises:
and generating a check packet by using a redundancy check method for the disassembled data packet.
4. The method of claim 1, wherein after receiving the data push packet, the client requests missing data of a packet type with a small number of missing packets according to the number of missing packets and check packets in the data push packet, including:
and after receiving the data push packet, the client judges whether a packet loss condition exists, if not, ignores the check packet, if so, reversely analyzes the transmitted data from the check packet when the check packet is complete, and when the check packet is missing, requests the data missing from the check packet if the missing quantity of the data packet is greater than the missing quantity of the check packet, and if the missing quantity of the data packet is less than or equal to the missing quantity of the check packet, requests the data missing from the data packet.
5. The method of claim 4, wherein adding the check packet to the data packet to obtain a data push packet comprises:
after the check packet is added to the data packet, numbering is carried out according to the sequence of the data packet and the check packet;
after receiving the data push packet, the client judges whether a packet loss condition exists or not, including:
and after receiving the data push packet, the client determines the packet loss condition and the packet loss number according to the number and the number of the data packet and the check packet in the data push packet.
6. A terminal for data pushing, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the following steps when executing the computer program:
receiving a data push request of a client, sending a data packet according to the data push request, and counting the packet loss ratio of long connection;
if the packet loss ratio is larger than a preset ratio, disassembling the data packet corresponding to the long connection, generating a check packet according to the data packet, and adding the check packet to the data packet to obtain a data push packet;
and sending the data push packet to the client by using the long connection, so that the client requests missing data of a packet type with a small missing quantity according to the missing quantity of the data packet and the check packet in the data push packet after receiving the data push packet.
7. The terminal for data push according to claim 6, wherein transmitting data packets according to the data push request and counting packet loss ratio of long connection comprises:
and sending a data packet according to the data push request, monitoring each heartbeat packet of the long connection and the sent data packet, and counting the packet loss ratio of each long connection in unit time.
8. The terminal for data push of claim 6, wherein generating a check packet from the data packet comprises:
and generating a check packet by using a redundancy check method for the disassembled data packet.
9. The terminal for data push according to claim 6, wherein after receiving the data push packet, the client requests missing data of a packet type with a small number of missing packets according to the number of missing packets and check packets in the data push packet, including:
and after receiving the data push packet, the client judges whether a packet loss condition exists, if not, ignores the check packet, if so, reversely analyzes the transmitted data from the check packet when the check packet is complete, and when the check packet is missing, requests the data missing from the check packet if the missing quantity of the data packet is greater than the missing quantity of the check packet, and if the missing quantity of the data packet is less than or equal to the missing quantity of the check packet, requests the data missing from the data packet.
10. The terminal for data push according to claim 9, wherein adding the check packet to the data packet to obtain a data push packet comprises:
after the check packet is added to the data packet, numbering is carried out according to the sequence of the data packet and the check packet;
after receiving the data push packet, the client judges whether a packet loss condition exists or not, including:
and after receiving the data push packet, the client determines the packet loss condition and the packet loss number according to the number and the number of the data packet and the check packet in the data push packet.
CN202310176171.9A 2023-02-28 2023-02-28 Data pushing method and terminal Pending CN116405546A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310176171.9A CN116405546A (en) 2023-02-28 2023-02-28 Data pushing method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310176171.9A CN116405546A (en) 2023-02-28 2023-02-28 Data pushing method and terminal

Publications (1)

Publication Number Publication Date
CN116405546A true CN116405546A (en) 2023-07-07

Family

ID=87011353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310176171.9A Pending CN116405546A (en) 2023-02-28 2023-02-28 Data pushing method and terminal

Country Status (1)

Country Link
CN (1) CN116405546A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116827893A (en) * 2023-08-29 2023-09-29 四川中电启明星信息技术有限公司 Real-time message pushing method for multi-level organization

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116827893A (en) * 2023-08-29 2023-09-29 四川中电启明星信息技术有限公司 Real-time message pushing method for multi-level organization
CN116827893B (en) * 2023-08-29 2023-11-10 四川中电启明星信息技术有限公司 Real-time message pushing method for multi-level organization

Similar Documents

Publication Publication Date Title
CN107979592B (en) Method and device for sending service request message
JP2011050073A (en) Method and device to optimize delivery of multicast content using probabilistic feedback
CN108306852B (en) Message middleware system and method based on simple binary coding
CN113676605A (en) Data transmission method, device, equipment and computer readable storage medium
CN109802773B (en) Social trust perception cooperative wireless network data transmission method
CN111711680A (en) File breakpoint continuous transmission method and device based on UDP (user Datagram protocol)
CN116405546A (en) Data pushing method and terminal
CN111181698B (en) Data processing method, device, equipment and medium
CN102685143B (en) Audio data transmission method, client side and server
CN110708234A (en) Message transmission processing method, message transmission processing device and storage medium
CN109756464B (en) Communication method, server and client
CN112612816B (en) Service result query method, device, equipment and medium of Ethernet alliance chain
CN103595552B (en) Analysis method and analysis system for cluster storage network parallel load
CN110012051A (en) Notify method for pushing, device, terminal device, server and system
CN110958084B (en) Method and communication equipment for transmitting acknowledgement message
CN114337942B (en) Message retransmission method and device and electronic equipment
CN114640705B (en) Large-scale Internet of things terminal heartbeat monitoring method
CN116032998B (en) Data transmission method, data transmission device, computer readable storage medium and electronic equipment
CN110690980A (en) Sending algorithm of market data
CN113535426B (en) Message issuing optimization method and server
CN111385069A (en) Data transmission method and computer equipment
CN114489730A (en) Remote upgrading method, terminal equipment and computer readable storage medium
CN110971535A (en) Communication congestion control method, device, equipment and storage medium
TWI811006B (en) Wireless internet of things system and wireless communication method thereof for reducing duty cycle
WO2024027367A1 (en) Encoding method and apparatus, and decoding method and apparatus

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