Summary of the invention
For solving above-mentioned technical problem, the present invention provides a kind of data sending, receiving method and device, data transmission method
And system, it is possible to ensure the integrity in data transmission procedure, it is achieved shunting device load balancing.
The technical scheme that the present invention provides is as follows:
The invention discloses a kind of data transmission method for uplink, send data to analysis for shunting device by TCP channel and set
Standby, including step: S11: to send and there is the message of sequence number to analytical equipment;S12: monitor whether receive analytical equipment feedback
Marking serial numbers;S13: when receiving the described marking serial numbers of analytical equipment feedback, records described marking serial numbers;S14: judge to divide
Whether flow device reconnects to new analytical equipment;If so, next step is performed, otherwise repeated execution of steps S11;S15: according to
The described marking serial numbers of the last record determines the beginning sequence number of next message to be sent;S16: according to described beginning sequence
Number send described message to new analytical equipment.
It is further preferred that further comprise the steps of: S10: according to preset rules, the message in sequence of message is compiled continuous print
Sequence number.
It is further preferred that described step S15 " determines next pending according to the described marking serial numbers of the last time record
The beginning sequence number of the message sent " specifically include step: S151: described marking serial numbers the last time recorded according to preset rules
Beginning sequence number as next message to be sent.
It is further preferred that further comprise the steps of: after described step S13 " marking serial numbers described in shunting device record "
S131: release sequence number comes the space that the described message before described marking serial numbers is corresponding.
The invention also discloses a kind of data receiver method, receive shunting device for analytical equipment by TCP channel and send out
The data sent, including step: S21: receive the message with sequence number that shunting device sends;S22: judge the described report received
Whether literary composition forms complete sequence of message;If so, next step is performed, otherwise, repeated execution of steps S21;S23: when receive
When described message forms complete sequence of message, feedback one marking serial numbers is to shunting device.
It is further preferred that described step S23 " feedback one marking serial numbers is to shunting device " specifically includes step: S231:
In the complete sequence of message that will be currently formed, the Next Sequence of the sequence number of last message returns as described marking serial numbers
It is fed to shunting device.
The invention also discloses a kind of data transmission method, for passing through TCP channel between shunting device and analytical equipment
Transmission data, including step: S11: shunting device sends has the message of sequence number to analytical equipment;S12: shunting device is monitored
The no marking serial numbers receiving analytical equipment feedback;S21: analytical equipment receives the message with sequence number that shunting device sends;
S22: analytical equipment judges whether the described message received forms complete sequence of message;If so, next step is performed, otherwise,
Repeated execution of steps S21;S23: when the described message received forms complete sequence of message, analytical equipment feedback one labelling
Sequence number is to shunting device;S13: when shunting device receives the described marking serial numbers of analytical equipment feedback, record described labelling
Sequence number;S14: shunting device judges whether to reconnect to new analytical equipment;If so, perform next step, otherwise repeat
Step S11;S15: shunting device determines opening of next message to be sent according to the described marking serial numbers that the last time records
Beginning sequence number;S16: shunting device sends described message to new analytical equipment according to described beginning sequence number.
It is further preferred that further comprise the steps of: S10: according to preset rules, the message in sequence of message is compiled continuous print
Sequence number.
It is further preferred that described step S23 " feedback one marking serial numbers is to shunting device " specifically includes step: S231:
In the complete sequence of message that will be currently formed, the Next Sequence of the sequence number of last message returns as described marking serial numbers
It is fed to shunting device.
It is further preferred that described step S15 " determines next pending according to the described marking serial numbers of the last time record
The beginning sequence number of the message sent " specifically include step: S151: described marking serial numbers the last time recorded according to preset rules
Beginning sequence number as next message to be sent.
It is further preferred that further comprise the steps of: after described step S13 " marking serial numbers described in shunting device record "
S131: release sequence number comes the space that the described message before described marking serial numbers is corresponding.
The invention discloses a kind of data sending device, for sending data to analytical equipment by TCP channel, including dividing
Flow device, described shunting device specifically includes: sending module, has the message of sequence number to analytical equipment for sending;Monitor mould
Block, for monitoring the marking serial numbers whether receiving analytical equipment feedback;Logging modle, for when receiving analytical equipment feedback
Described marking serial numbers time, record the marking serial numbers of described analytical equipment feedback;Connection judgment module, is used for judging shunting device
Whether reconnect to new analytical equipment;Determine module, for reconnecting to new analytical equipment when described shunting device
Time upper, determined the beginning sequence number of next message to be sent according to the described marking serial numbers of the last time record;Described transmission
Module is additionally operable to send described message to new analytical equipment according to described beginning sequence number.
It is further preferred that also include: numbering module, for the message in sequence of message being compiled even according to preset rules
Continuous sequence number.
Determine that module is specifically for the described labelling recorded the last time according to preset rules it is further preferred that described
Sequence number is as the beginning sequence number of next message to be sent.
It is further preferred that also include: release module, come the described report before described marking serial numbers for discharging sequence number
The space that literary composition is corresponding.
The invention also discloses a kind of data sink, for receiving, by TCP channel, the data that shunting device sends,
Including analytical equipment, described analytical equipment specifically includes: receiver module, for receiving the report with sequence number that shunting device sends
Literary composition;Sequence of message judge module, for judging whether the described message received forms complete sequence of message;Feedback module,
During for forming complete sequence of message when the described message received, feedback one marking serial numbers is to shunting device.
It is further preferred that described feedback module specifically in the complete sequence of message that will currently be formed last
The Next Sequence of the sequence number of message is fed back to shunting device as described marking serial numbers.
The invention also discloses a kind of data transmission system, for transmitting data by TCP channel, send dress including data
Putting and data sink, described data sending device includes shunting device;Described shunting device specifically includes: sending module,
There is the message of sequence number to analytical equipment for sending;Monitor module, for monitoring the mark whether receiving analytical equipment feedback
Note sequence number;Logging modle, for when receiving the described marking serial numbers of analytical equipment feedback, records described analytical equipment feedback
Marking serial numbers;Connection judgment module, for judging whether shunting device reconnects to new analytical equipment;Determine module,
For when described shunting device reconnects in new analytical equipment, according to the last time, the described marking serial numbers of record is true
The beginning sequence number of fixed next message to be sent;Described sending module is additionally operable to send described message according to described beginning sequence number
To new analytical equipment;Described data sink includes that analytical equipment, described analytical equipment specifically include: receiver module, uses
In receiving the message with sequence number that shunting device sends;Sequence of message judge module, for judging the described message received
Whether form complete sequence of message;Feedback module, for when the described message received forms complete sequence of message, returns
Present a marking serial numbers to shunting device.
It is further preferred that described shunting device also includes: numbering module, it is used for according to preset rules in sequence of message
Message compile continuous print sequence number.
Determine that module is specifically for the described labelling recorded the last time according to preset rules it is further preferred that described
Sequence number is as the beginning sequence number of next message to be sent.
It is further preferred that described feedback module specifically in the complete sequence of message that will currently be formed last
The Next Sequence of the sequence number of message is fed back to shunting device as described marking serial numbers.
It is further preferred that described shunting device also includes: release module, it is used for discharging sequence number and comes described marking serial numbers
The space that the sequence of message at described message place before is corresponding.
Compared with prior art, the present invention between shunting device and analytical equipment by message is compiled continuous print
The mode of sequence number guarantees to send the integrity of sequence of message.If equipment goes offline or software crash, shunting device will divide with new
Desorption device is set up and is connected, or analytical equipment is very slow, and the message causing shunting device to accumulate gets more and more, and shunting device actively disconnects
Connect, set up with new analytical equipment and be connected, all can start again to transmit message from the marking serial numbers of analytical equipment feedback last time,
Guarantee the integrity for the sequence of message analyzed.
Detailed description of the invention
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will comparison accompanying drawing explanation
The detailed description of the invention of the present invention.It should be evident that the accompanying drawing in describing below is only some embodiments of the present invention, for
From the point of view of those of ordinary skill in the art, on the premise of not paying creative work, it is also possible to obtain other according to these accompanying drawings
Accompanying drawing, and obtain other embodiment.
For making simplified form, only schematically show part related to the present invention in each figure, they do not represent
It is as the practical structures of product.It addition, so that simplified form readily appreciates, some figure has identical structure or function
Parts, only symbolically depict one of them, or have only marked one of them.In this article, " one " not only represents
" only this ", it is also possible to represent the situation of " more than one ".
Fig. 1 is the key step schematic diagram of a kind of data transmission method for uplink of the present invention, and one as the present invention is embodied as
Example, as it is shown in figure 1, a kind of data transmission method for uplink, sends data to analytical equipment for shunting device 110 by TCP channel
220, including step: S11: send and there is the message of sequence number to analytical equipment 220;S12: monitor whether receive analytical equipment
The marking serial numbers of 220 feedbacks;S13: when receiving the described marking serial numbers of analytical equipment 220 feedback, records described labelling sequence
Number;S14: judge whether shunting device 110 reconnects to new analytical equipment 220;If so, perform next step, otherwise repeat
Perform step S11;S15: determine the beginning sequence of next message to be sent according to the described marking serial numbers of the last time record
Number;S16: send described message to new analytical equipment 220 according to described beginning sequence number.
Concrete, the data transmission method for uplink of the present invention is set up between shunting device 110 and analytical equipment 220, Qi Zhongfen
Flow device 110 and analytical equipment 220 set up TCP channel, send TCP message sequence.By in the sequence of message complete to
Multiple messages carry out compiling sequence number, then by the marking serial numbers of analytical equipment 220 feedback, the TCP Client of shunting device 110
The sequence number of the message of the sequence of message sent is needed when can determine that reconnect.Send message by this marking serial numbers, protect
Demonstrate,prove the integrity that sequence of message sends, prevented loss of data, improve the work efficiency of analytical equipment 220.
Preferably, said method further comprises the steps of: S10: according to preset rules, the message in sequence of message is compiled even
Continuous sequence number.Concrete, Fig. 2 is that in a kind of data transmission method for uplink of the present invention, the sequence number of message compiles schematic diagram, as in figure 2 it is shown,
Message different in size, each message has a numbering, starts message is compiled sequence number from message 1, can rollback.The sequence of message
Number it is continuous print, as it can be seen, from sequence number 3 to sequence number 12.If 16, after having arrived 0xffff, next test serial number
It is 0.
Above-described embodiment is improved, obtains preferred embodiment.Fig. 3 is the complete of a kind of data transmission method for uplink of the present invention
The rapid schematic diagram of synchronizing.As a specific embodiment of the present invention, as it is shown on figure 3, a kind of data transmission method for uplink, including step:
S10: the message in sequence of message is compiled continuous print sequence number according to preset rules;S11: send the message with sequence number to analyzing
Equipment 220;S12: monitor the marking serial numbers whether receiving analytical equipment 220 feedback;S13: when receiving analytical equipment 220 times
During the described marking serial numbers presented, record described marking serial numbers;S14: judge whether shunting device 110 reconnects to new analysis
Equipment 220;If so, next step is performed, otherwise repeated execution of steps S11;S151: the last time is recorded according to preset rules
Described marking serial numbers is as the beginning sequence number of next message to be sent;S16: send described message according to described beginning sequence number
To new analytical equipment 220.
Concrete, the present invention marking serial numbers by analytical equipment 220 feedback, can determine whether that a complete sequence of message is
No transmission completely is terminated, simultaneously when shunting device 110 reconnects new analytical equipment 220, it is possible to determine next step needs
The test serial number sent, it is to avoid occur that the message in a sequence of message sends to different analytical equipments 220, cause message not
Completely, it is impossible to carry out the analysis of sequence of message.
Preferably, S131 is further comprised the steps of: after described step S13 " shunting device 110 records described marking serial numbers ": release
Put sequence number and come the space that the described message before described marking serial numbers is corresponding.Concrete, the present invention is learnt by marking serial numbers
Complete message sequence, the space corresponding to complete sequence of message that timely removing has sent and received, it is possible to reduce slow
The memory space that the data deposited take, improves the processing speed of shunting device 110.
Fig. 4 is the step schematic diagram of the present invention a kind of data receiver method, as another specific embodiment of the present invention,
As shown in Figure 4, a kind of data receiver method, receive, by TCP channel, the number that shunting device 110 sends for analytical equipment 220
According to, including step: S21: receive the message with sequence number that shunting device 110 sends;S22: judge the described message received
Whether form complete sequence of message;If so, next step is performed, otherwise, repeated execution of steps S21;S23: when the institute received
Stating message when forming complete sequence of message, feedback one marking serial numbers is to shunting device 110.
Concrete, the data receiver method of the present invention is set up between shunting device 110 and analytical equipment 220, Qi Zhongfen
Flow device 110 and analytical equipment 220 set up TCP channel, receive TCP message sequence.The analytical equipment 220 of the present invention is when receiving
With sequence number message form a complete sequence of message time one marking serial numbers of feedback to shunting device 110.Because point
The TCP Client of flow device 110 only has the ability sending data, it is impossible to process the response letter of complicated analytical equipment 220
Breath, also cannot oneself go to understand which message can make up a complete analytical sequence, therefore, the data receiver of the present invention
By one marking serial numbers of feedback, method can inform that its sequence of message sent of shunting device 110 the most completely and is specifically sent out
Send and complete which sequence of message.
Preferably, described step S23 " feedback one marking serial numbers is to shunting device 110 " specifically includes step S231: ought
In the complete sequence of message of front formation, the Next Sequence of the sequence number of last message is fed back to as described marking serial numbers
Shunting device 110.Concrete, marking serial numbers in the present invention can represent complete sequence of message, can be complete by receive
In sequence of message, the sequence number of last message is as marking serial numbers, it is also possible to by last message in complete sequence of message
The Next Sequence of sequence number be fed back to shunting device 110 as described marking serial numbers.Marking serial numbers does not make concrete restriction, can
Sets itself.
Fig. 5 is the key step schematic diagram of a kind of data transmission method of the present invention, and one as the present invention is embodied as
Example, as it is shown in figure 5, a kind of data transmission method, for being transmitted by TCP channel between shunting device 110 and analytical equipment 220
Data, including step: S11: shunting device 110 sends has the message of sequence number to analytical equipment 220;S12: shunting device 110
Monitor the marking serial numbers whether receiving analytical equipment 220 feedback;S21: analytical equipment 220 receives what shunting device 110 sent
There is the message of sequence number;S22: analytical equipment 220 judges whether the described message received forms complete sequence of message;If
It is to perform next step, otherwise, repeated execution of steps S21;S23: when the described message received forms complete sequence of message
Time, analytical equipment 220 feedback one marking serial numbers is to shunting device 110;S13: when shunting device 110 receives analytical equipment 220
During the described marking serial numbers of feedback, record described marking serial numbers;S14: shunting device 110 judges whether to reconnect to new dividing
Desorption device 220;If so, next step is performed, otherwise repeated execution of steps S11;S15: shunting device 110 is according to the last record
Described marking serial numbers determine the beginning sequence number of next message to be sent;S16: shunting device 110 is according to described beginning sequence
Number send described message to new analytical equipment 220.
Concrete, the data transmission method of the present invention is set up between shunting device 110 and analytical equipment 220, including on
The data transmission method for uplink stated and data method of reseptance.Wherein shunting device 110 and analytical equipment 220 set up TCP channel, transmission
TCP message sequence.Shunting device 110 is compiled sequence number by the multiple messages in the sequence of message complete to and is sent
To analytical equipment 220, analytical equipment 220 one marking serial numbers of feedback extremely shunting when message one complete sequence of message of composition
Equipment 110.Shunting device 110 when reconnecting new analytical equipment 220 according to marking serial numbers, it may be determined that need the report sent
The sequence number of the message of literary composition sequence.Ensure that, by this marking serial numbers, the integrity that sequence of message sends, prevent loss of data, carry
The work efficiency of high analyte equipment 220.
Preferably, S10 is further comprised the steps of:: according to preset rules, the message in sequence of message is compiled continuous print sequence number.
Preferably, described step S23 " feedback one marking serial numbers is to shunting device 110 " specifically includes step: S231: ought
In the complete sequence of message of front formation, the Next Sequence of the sequence number of last message is fed back to as described marking serial numbers
Shunting device 110.
Preferably, described step S15 " determines next report to be sent according to the described marking serial numbers of the last time record
The beginning sequence number of literary composition " specifically include step: S151: described marking serial numbers the last time recorded according to preset rules as under
The beginning sequence number of one message to be sent.
Preferably, S131 is further comprised the steps of: after described step S13 " shunting device 110 records described marking serial numbers ": release
Put sequence number and come the space that the described message before described marking serial numbers is corresponding.
The transmission flow of the present invention a kind of data transmission method for uplink is discussed in detail below in conjunction with Fig. 2.
As in figure 2 it is shown, shunting device 110 passes to analytical equipment 220 message 3,4,5,6,7, analytical equipment 220 receives into
Merit.
Analytical equipment 220 is 6 to shunting device 110 feedback marking serial numbers, and the message before showing sequence number 6 has had become as
Whole sequence, analyzes complete.Shunting device 110 can discharge sequence number 6 before space corresponding to message, the next message analyzed
Sequence is by the start of heading from serial number 6.
Shunting device 110 continues to pass to analytical equipment 220 message 8,9, and analytical equipment 220 receives successfully.
Analytical equipment 220 gives shunting device 110 feedback marking serial numbers 10, and the message before showing sequence number 10 has had become as
Whole sequence, analyzes complete, and shunting device 110 can discharge the space that the message before 10 is corresponding, the next message sequence analyzed
Row will be from the beginning of 10.
Shunting device 110 continues to pass to analytical equipment 220 message 10,11, and analytical equipment 220 receives successfully.
Analytical equipment 220 goes wrong (equipment goes offline or software crash).
Shunting device 110 reconnects new analytical equipment 220, from the marking serial numbers of analytical equipment last time 220 feedback, i.e.
10, start to continue to transmit message 10,11,12, analytical equipment 220 receives successfully.
Analytical equipment 220 gives shunting device 110 feedback marking serial numbers 12, and the message before showing sequence number 12 has had become as
Whole sequence, analyzes complete, and shunting device 110 can discharge the space that the message before 12 is corresponding, and next analytical sequence will be from
Sequence number 12 starts.
Fig. 6 be a kind of data sending device of the present invention mainly comprise schematic diagram.One as the present invention is embodied as
Example, as shown in Figure 6, a kind of data sending device, for sending data to analytical equipment 220 by TCP channel, set including shunting
Standby 110, described shunting device 110 specifically includes: sending module 111, has the message of sequence number to analytical equipment for sending
220;Monitor module 112, for monitoring the marking serial numbers whether receiving analytical equipment 220 feedback;Logging modle 113, is used for
When receiving the described marking serial numbers of analytical equipment 220 feedback, record the marking serial numbers of described analytical equipment 220 feedback;Even
Connect judge module 114, for judging whether shunting device 110 reconnects to new analytical equipment 220;Determine module 115, use
In time reconnecting in new analytical equipment 220 when described shunting device 110, according to the described labelling sequence of the last time record
Number determine the beginning sequence number of next message to be sent;Described sending module 111 is additionally operable to send according to described beginning sequence number
Described message is to new analytical equipment 220.
Preferably, also include numbering module 116, for the message in sequence of message being compiled continuous print according to preset rules
Sequence number.
Preferably, described determine that module 115 is specifically for the described labelling sequence recorded the last time according to preset rules
Number as the beginning sequence number of next one message to be sent.
Preferably, also include: release module 117, come the described message before described marking serial numbers for discharging sequence number
Corresponding space.
It should be noted that the content such as mutual, the execution process of information between each module is sent out with above-mentioned data in this device
Delivery method embodiment is based on same design, and particular content can be found in the narration in data transmission method for uplink embodiment of the present invention, herein
Repeat no more.
Fig. 7 be a kind of data sink of the present invention mainly comprise schematic diagram.One as the present invention is embodied as
Example, as it is shown in fig. 7, a kind of data sink, for receiving, by TCP channel, the data that shunting device 110 sends, including dividing
Desorption device 220, described analytical equipment 220 specifically includes: receiver module 221, for receive shunting device 110 send there is sequence
Number message;Sequence of message judge module 222, for judging whether the described message received forms complete sequence of message;
Feedback module 233, for when the described message received forms complete sequence of message, feedback one marking serial numbers sets to shunting
Standby 110.
Preferably, described feedback module 233 is specifically for last report in the complete sequence of message that will currently be formed
The Next Sequence of the sequence number of literary composition is fed back to shunting device 110 as described marking serial numbers.
It should be noted that the content such as mutual, the execution process of information between each module connects with above-mentioned data in this device
Receiving method embodiment is based on same design, and particular content can be found in the narration in data receiver method embodiment of the present invention, herein
Repeat no more.
Fig. 8 be a kind of data transmission system of the present invention mainly comprise schematic diagram, one as the present invention is embodied as
Example, as shown in Figure 8, a kind of data transmission system, for transmitting data by TCP channel, including data sending device and data
Receiving device, described data sending device includes shunting device 110;Described shunting device 110 specifically includes: sending module 111,
There is the message of sequence number to analytical equipment 220 for sending;Monitor module 112, for monitoring whether receive analytical equipment 220
The marking serial numbers of feedback;Logging modle 113, for when receiving the described marking serial numbers of analytical equipment 220 feedback, records institute
State the marking serial numbers of analytical equipment 220 feedback;Connection judgment module 114, is used for judging whether shunting device 110 reconnects to
New analytical equipment 220;Determine module 115, for reconnecting to new analytical equipment 220 when described shunting device 110
Time, the beginning sequence number of next message to be sent is determined according to the described marking serial numbers of the last time record;Described transmission mould
Block 111 is additionally operable to send described message to new analytical equipment 220 according to described beginning sequence number;Described data sink includes
Analytical equipment 220, described analytical equipment 220 specifically includes: receiver module 221, for receiving having of shunting device 110 transmission
The message of sequence number;Sequence of message judge module 222, for judging whether the described message received forms complete message sequence
Row;Feedback module 233, for when the described message received forms complete sequence of message, feedback one marking serial numbers is to dividing
Flow device 110.
Fig. 9 be a kind of data transmission system of the present invention be fully composed schematic diagram.One as the present invention is embodied as
Example, as it is shown in figure 9, described shunting device 110 also includes: numbering module 116, is used for according to preset rules in sequence of message
Message compiles continuous print sequence number.
Preferably, described determine that module 115 is specifically for the described labelling sequence recorded the last time according to preset rules
Number as the beginning sequence number of next one message to be sent.
Preferably, described feedback module 233 is specifically for last report in the complete sequence of message that will currently be formed
The Next Sequence of the sequence number of literary composition is fed back to shunting device 110 as described marking serial numbers.
Preferably, as it is shown in figure 9, described shunting device 110 also includes: release module 117, it is used for discharging sequence number and comes institute
State the space that the sequence of message at described message place before marking serial numbers is corresponding.
The data transmission system of the present invention is set up between shunting device 110 and analytical equipment 220, including above-mentioned data
Dispensing device and data sink.Wherein shunting device 110 and analytical equipment 220 set up TCP channel, transmit TCP message sequence
Row.Shunting device 110 compiles sequence number by the multiple messages in the sequence of message complete to and transmission sets to analysis
Standby 220, analytical equipment 220 when message one complete sequence of message of composition one marking serial numbers of feedback to shunting device 110.
Shunting device 110 when reconnecting new analytical equipment 220 according to marking serial numbers, it may be determined that the sequence of message needing to send
The sequence number of message.Ensure that, by this marking serial numbers, the integrity that sequence of message sends, prevent loss of data, improve analysis and set
The work efficiency of standby 220.
It should be noted that the content such as mutual, the execution process of information between each module is real with said method in native system
Executing example based on same design, particular content can be found in the narration in the inventive method embodiment, and here is omitted.
It should be noted that, above-described embodiment all can independent assortment as required.The above is only the preferred of the present invention
Embodiment, it is noted that for those skilled in the art, in the premise without departing from the principle of the invention
Under, it is also possible to making some improvements and modifications, these improvements and modifications also should be regarded as protection scope of the present invention.