CN101018176A - Reliable transfer method of short message in the ad hoc network - Google Patents

Reliable transfer method of short message in the ad hoc network Download PDF

Info

Publication number
CN101018176A
CN101018176A CN 200710079762 CN200710079762A CN101018176A CN 101018176 A CN101018176 A CN 101018176A CN 200710079762 CN200710079762 CN 200710079762 CN 200710079762 A CN200710079762 A CN 200710079762A CN 101018176 A CN101018176 A CN 101018176A
Authority
CN
China
Prior art keywords
syn
fin
data
message
ack
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.)
Granted
Application number
CN 200710079762
Other languages
Chinese (zh)
Other versions
CN100505663C (en
Inventor
王宇亮
章洋
郑昌文
何晓新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Software of CAS
Original Assignee
Institute of Software of CAS
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 Institute of Software of CAS filed Critical Institute of Software of CAS
Priority to CNB2007100797625A priority Critical patent/CN100505663C/en
Publication of CN101018176A publication Critical patent/CN101018176A/en
Application granted granted Critical
Publication of CN100505663C publication Critical patent/CN100505663C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The provided method for reliable transmitting data in Ad Hoc network comprises: with syn, data-ack and fin message, building connection between the transmitting and receiving sides to make the receiving side obtain data without waiting for three time handshake; communicating between two sides by data-ack means to send message; once transmitting the last package, sending close-connection message to make the receiving side start the close procedure. This invention reduces message quantity and time delay, and improves system executive efficiency.

Description

Reliable transfer method of short message in the self-organizing network
Technical field
The invention belongs to network communications technology field, be meant the method for transmitting data in a kind of self-organizing network reliably especially.
Background technology
Ad Hoc network is not rely on network infrastructure, cooperates mutually by radio communication between the node and carries out route, the interim a kind of multi-hop wireless communication network that constitutes.Because Ad Hoc network has very high survival ability and flexibility, so be widely used in fields such as military affairs, industry, commerce, medical treatment, family, working environment, its typical applications comprises military communication, emergency searching and rescuing, mobile meeting, wireless home network, sensor network etc.
As one of key technology difficult problem that must solve in the Ad Hoc network, the main task of transport layer protocol comprises reliable transmission and congested control.In legacy network, TCP born Internet go up the Network Transmission total bytes 95% and total data message number 90%, it realizes that version is also abundant unusually, from TCP-Tahoe, TCP-Reno, TCP-NewReno be to TCP-Vegas, TCP-Veno, FAST-TCP.Yet, when being applied directly to the TCP in the legacy network in the wireless network, because wireless network has the advantages that very high error rate and mobility etc. differ from cable network, its performance loss is very big, is embodied in: excessive connection expense with set up latency issue, based on the congested indication problem of message dropping, the overtime exponential backspace problem of TCP after the network detach, concealed terminal and ACK rely on problem, congested control of LIMD and route reselection problem, the too fat to move head problem that configurability is low.At these problems, occurred a lot of technology both at home and abroad and attempted to improve the transport layer protocol performance.These technology can be divided into improves and designs New Deal two large divisions based on speed to TCP, and wherein the former can be subdivided into end-to-end scheme again and stride layered scheme two parts.End-to-end technical scheme comprises the TCP Fixed RTO scheme that solves the overtime exponential backspace problem of TCP, consider that the route reconstruction causes the TCP-DOOR scheme of out-of-sequence message, consider the unusual and long-term unusual TCP Freeze-Probing scheme of short-term, avoid the Eifel method of STO (Spurious Time Out), distinguish the Bias of error code packet loss and congestion packet loss, mBias, Spike, Zigzag, schemes such as TCP-DCR use delay ack to reduce the scheme of reverse link collisions, as TCP-LDA, TCP-ADA, TCP-DAA, TCP-DBA etc.Stride layer technical scheme and comprise the TCP-F that pays attention to distinguish network congestion packet loss and routing failure packet loss, TCP-ELFN, ATCP, schemes such as TCP-BuS, pay attention to reduce the split TCP technical scheme of routing failure influence, taken all factors into consideration network and be in that congested, link disconnection, channel error, route change, the ADTCP technical scheme of different conditions situation such as normal.With ATP, EXACT is representative based on the New Deal of speed, and its technology path is to collect necessary information to transmit message to select suitable speed when route.
In above technical scheme, no matter be the agreement of redesign, still on the TCP basis, carry out improved agreement, all only solved a certain subproblem of Network Transmission among the Ad Hoc, and all adopted identical connection to create a mechanism: three-way handshake.Because three-way handshake mechanism can not submit to data to give the recipient before connecting foundation, this means the submitted extra time delay of all necessary experience RTT before of any data, in the low-speed wireless self-organizing network that reality is used, this might reach some seconds.
In some mobile ad hoc network applied environment, a lot of for example important environment measured values of data, short and small command information only account for several to dozens of bytes and need reliable transmission in real time, and carrying out shaking hands for 3 times for the transmission of this information is undoubtedly huge waste.Even to general message, owing to there is very big delay in the wireless self-networking, and the dynamic topological structure of dynamically adding of node, deviated from network and node motion generation, also may cause regular connection to set up process, time-delay that use three-way handshake mechanism to connect to bring this moment and excessive network overhead are insufferable often.Yet it is the necessary condition that guarantees the message reliable transmission that three-way handshake connects, and how to get around three-way handshake mechanism, shortens connection setup time, alleviates network overhead and just becomes the problem that will solve.In this respect, unique approaching technology is T/TCP, and it by add 1~2 CC option that reaches 32 in connecting message, can avoid three-way handshake process at the design of the affairs support in the wired network in some cases.But it needs the recipient to keep a historical record for each remote host, and after connection or main frame are restarted for the first time, all all can enter common three-way handshake process to the connection that connection or this main frame of this main frame send, at this moment, T/TCP not only can not solve original problem, also can increase the expense of network overhead and host process.In the dynamic topology environment of Ad Hoc network, this situation may often occur.Another problem is, above agreement all designs at ordinary circumstance, the a lot of contents that comprise in its heading are when reality is used, used too much byte, there is not actual use, the heading of a relative compact of design is necessary, and can saves considerable network overhead in low speed Ad Hoc network.
In the realization of agreement, traditional method is to adopt top-down design, and most of procedural language C that adopts realizes complicated protocol state machine as its realization technology by huge branch's redirect statement.After the nineties, the software design mode has obtained significant progress, and what be embodied in the Object-Oriented Design mode popularizes the use of Design Mode, and the appearance of bottom-up event programme model.Incident is that some variation has taken place the object internal state, when perhaps object is done some action, and the notice of sending to the external world.External environment condition is tackled the generation of these incidents, can make corresponding reaction.With respect to top-down process programming model, bottom-up event programme model more is applicable to the uncertain real-time event responding system of order of occurrence, for example in the design of procotol and the realization.Basically, the message programming model of Windows can be regarded the blank of event model as, yet the mode of Windows processing events is by window procedure and unalterable WPARAM/LPARAM parameter fully, and is with the modern programming standard, simple and crude and coarse.For the transmission incident, even need to create invisible window.In fact strict, window procedure is not a case mechanism truly, because each window only allows to have a window procedure, and in real event system, identical incident can be regardless of a plurality of recipients of grade ground registration.Integrated event model in emerging C# and the Java language, the also integrated incident in the .Net framework, and use to entrust and realize.Yet, it is not high that C# and Java language written program are carried out efficient, and its case mechanism is at design generally speaking, the special circumstances at procotol do not customize, data transferring method for example is not provided, therefore and be not suitable for developing procotol the transfer complex data can only be undertaken by the mode that global variable is set.The C Plus Plus written program is carried out the efficient height, owing to can directly control internal memory, therefore be more suitable in carrying out low level development, and because its OO characteristic, can use encapsulation, modernisms such as Design Mode provide better modularization, make the agreement easy to understand, revising and expansion, is the first-selected language of design agreement therefore.Regrettably, C Plus Plus does not have integration events mechanism.
Summary of the invention
In view of this, the object of the present invention is to provide the method for transmitting data in a kind of Ad Hoc network reliably, improved the efficiency of transmission and the real-time of data.
In order to achieve the above object, technical scheme of the present invention is achieved in that
The method of high efficient and reliable ground transmission data in a kind of Ad Hoc network, realize reliable transmission by syn, ack and fin message, this method may further comprise the steps: transmit leg initiates to connect, transmission message syn1 (data, syn, syn-ts1), wherein data represents data, syn represents to connect and sets up request flag, and syn-ts1=current time+overtime timer regularly is the overtime retransmission time of this message; The recipient receive syn1 (data, syn, syn-ts1) after, take out syn-ts1, if syn-ts1>current time is then accepted message and connected, otherwise refusal connects; Transmit leg and recipient adopt the data-ack interactive mode to communicate subsequently; Transmit leg is a bag after data delivery finishes in the end, can send connection closed request message fin (data, fin, fin-ts), wherein data represents data, and fin represents the connection closed request flag, fin-ts=max (current time, connect the time stamp that comprises in the last syn message that sends), for the concluding time stabs; After the recipient receives turn-off request, start to close closed procedure, close connection constantly in certain that is no earlier than fin-ts.
Further, if constantly successfully do not connect as yet at syn-ts1, transmit leg then is judged as and sends message syn1 (data, syn, syn-ts1) overtime, and syn-ts1 send constantly syn2 (data, syn, syn-ts2), again request connects, wherein syn-ts2=current time+overtime timer regularly, it be transmit leg overtime after, the delivery time of next syn message.
Further, also comprise syn-no and fin-no parameter in syn and the fin message respectively, wherein syn-no is an initial sequence number, generates according to hardware clock, and fin-no is an end sequence number.
Further, contain it in the ack message and confirm the pairing sequence number of data, when ack returned, all data that sent before the data of its affirmation all were identified.
Further, the recipient starts the passive open process after receiving the syn message, if receive message syn (syn-no, data, syn, moment syn-ts) is now, the sequence number if now>syn-ts or connection exist among last ack is greater than syn-no, then refuse this message, otherwise receive and newly-built connection.
Further, the recipient receive message fin (fin-no, data, fin, fin-ts) back starts passive pass closed procedure, if this moment now>fin-ts constantly, remove and connect, otherwise remove connection constantly at fin-ts.
The present invention is applied in the Ad Hoc self-organizing network, carry out the reliable transmission of short message, thereby realize reducing message amount, significantly reduce to connect the delay and the network overhead of foundation, and come the configuration message form according to the network characteristic that reality is used, thereby saved network overhead; Simultaneously, reduced the number of threads of using during agreement realizes, improved system and carried out efficient.
The present invention compares with agreement in the past, and innovative point is mainly reflected in following three aspects: first transmission mechanism, high configurable succinct message design, sequential event engine.Preceding two aspects are the innovations on design of protocol, and the sequential event engine is the innovation on agreement realizes.
Description of drawings
Fig. 1 is that expired message causes the incorrect link schematic diagram in the prior art;
Fig. 2 is that the present invention delays to produce the solution schematic diagram that repeats SYN message problem to SYN;
Fig. 3 is that sequence number is filtered because SYN-ACK loses or the schematic diagram of the repetition SYN message of the generation of delaying;
Fig. 4 is that overtime filtration is because SYN-ACK loses or the schematic diagram of the repetition SYN message of the generation of delaying;
Fig. 5 is that the protocol module that the present invention is based on the sequential event engine is divided (responsibility is with mutual) schematic diagram;
Fig. 6 is a protocol state machine schematic diagram of the present invention.
Fig. 7 has demonstrated the complete next time message transmission procedure of normal condition.
Fig. 8 has demonstrated the processing procedure under the abnormal conditions.
Embodiment
One first data transmission mechanism
First data transmission mechanism has been saved network overhead by avoiding three-way handshake process, has improved the real-time of message transmissions, is described in detail as follows:
1. the reason of former agreement three-way handshake
Investigate TCP and carry out the reason of three-way handshake, if do not carry out three-way handshake, then recipient's SYN message that may repeat because of delaying arrives and sets up wrong connection, and then to the data of upper strata submittal error, repetition.Notice that then receiving terminal can filter seq-no by last-ack if the message of delaying to repeat connects when arriving not to be closed.Therefore, have only when the message of delaying, repeating arrives receiving terminal, to connect and close, just can set up wrong connection.
The SYN message that repeats is retransmitted by message and causes, the reason that message retransmits comprises: SYN loses, SYN delays, SYN-ACK loses, SYN-ACK delays, and wherein SYN loses the SYN message that can't produce repetition, SYN is delayed to produce repetition SYN message here and is called problem one, SYN-ACK loses or delays to produce the SYN message that repeats and is called problem two, as shown in Figure 1.
2. first transmission algorithm
First transmission mechanism is avoided three-way handshake by the mode that time stamp adds sequence number, and algorithm is as follows:
1) connect the process of setting up: transmit leg starts initiatively opening procedure, and (syn-no, syn-ts), wherein syn-no is an initial sequence number, generates according to hardware clock to send SYN.Syn-ts is the moment of the overtime re-transmission of message for this reason, sets up in the message in connection to comprise data.The recipient accepts to start the passive open process behind the message, establish receive the SYN message (syn-no, moment syn-ts) is now, last-ack>syn-no then refuses this message if now>syn-ts or connect exists, otherwise receives and newly-built connection.
2) connection closed process: initiatively the side of closing when all data messages all behind the end of transmission startup initiatively close closed procedure, transmission FIN (fin-no, fin-ts).Wherein fin-no is an end sequence number, and fin-ts is for finishing time stamp, and satisfies fin-ts=max (syn-ts that connects the last SYN message correspondence that sends, current time).The passive side of closing receives the FIN message, and (fin-no, fin-ts) the passive pass of back startup closed procedure is if moment this moment now>fin-ts removes connection.Otherwise remove connection constantly at fin-ts.
Basic idea is to guarantee not have two effective SYN messages of while in the network, thus deal with problems effectively one with problem two.If front and back send two SYN message syn1 (syn-no, syn-ts1) with syn2 (syn-no, syn-ts2).For problem one, if syn1 and syn2 connect the back and the end of transmission after arrive, syn1 due in>syn2 due in>syn2 transmitting time>syn-ts1 is then arranged, thereby syn1 is rejected, as shown in Figure 2.For problem two, establish receiving terminal and receive syn constantly at now (syn-no syn-ts), if connect this moment does not close, and then can filter syn-no according to the value of last-ack, as shown in Figure 3.If connect this moment close, now>fin-ts>=syn-ts then, thus syn is rejected, as shown in Figure 4.For preventing that machine collapse back from producing incorrect link, must wait for the tranquil time of MSL after the start.
3. suitable environment
In the very big Ad Hoc environment of network delay, as long as clock drift is no more than the minimum time-delay of single-hop, just can use first transmission mechanism to replace three-way handshake mechanism, avoid preceding twice handshake procedure in the three-way handshake.What deserves to be mentioned is that this environment is unrare, for example transmission node has overall time service equipment such as GPS, perhaps when single-hop time-delay is very big, finish initially to the time node the internal clock drift can not surpass the single-hop time-delay in considerable time.
4. effect
Use first data transmission mechanism to avoid the required stand-by period of three-way handshake, reduced the message amount in the network, and need not receiving terminal any information of maintenance outside connecting.Owing to only add time stamp in the FIN message of the SYN message that transmits beginning and the end of transmission, therefore average additional message length expense is almost 0.The note receiving-transmitting sides one-way time is t, when data were in a MTU, the recipient only needed the t time can receive data, and three-way handshake mechanism recipient needs the 3t time just can receive data, in this case, the real-time of first connection mechanism has improved 3 times.For the transmission of short message, the quantity of exchange message also significantly reduces in the network.Because it is first transmission mechanism can significantly reduce to connect the delay and the network overhead of foundation, therefore effective especially for frequent generation short message transmission.
Two, high configurable succinct message design
1. message format and explanation thereof
Message format is as follows:
0-15 15-31
source port destination port
Type Head len Reserved Seq#
Additional Header
Data
Source port and destination port represent source port and destination interface respectively.
Everybody is followed successively by SYN type, FIN, and ACK, SACK, TS, CS keeps 2, represents start message respectively, end message, piggybacking is incidentally selected to confirm, has verification, has time stamp.FIN can not be with data, and SYN, FIN can not occur simultaneously, and TS occurs simultaneously with SYN, FIN only.SYN, FIN can carry data, and the difference of its meaning of one's words and TCP is to have only REQUEST that SYN, FIN can be set, and ACCEPT can not be provided with SYN, FIN.
Head len is a head length, is that unit counts with the double byte, thus head the longest be the 15*2=30 byte.
Reserved is a reserved field.
Seq# is the window sequence number.At relatively low channel speed, sequence number uses 2 bytes.
Additional Header comprises 16 ACK at present, 16 Checksum, 32 time stamps and 16 SACK.
ACK represents to expect the sequence number of next bag.The same with sequence number, its length is 2 bytes.
SACK represents that [first always is 0 for ACK, receive window state ACK+16), and for example 0110000000000000 represents ack+1, and the message of ack+2 is received.
TS represents time stamp, can its mask precision (only for this locality) be set by connecting.Because 1ms is equivalent to the changing value of FILETIME 10900, about 14,64 altogether of FILETIME are so desirable FILETIME [12,43] position is as time stamp.The desirable 50ms of mask precision default value, promptly 19 of FILETIME, back 7 of TS are so acquiescence precision mask is the 32-7=25 position.CS be verification and, can be by connect being provided with.
Checksum is a checksum field, because most of Ad Hoc environment have a reliable link layer, so with verification be made as optional head, can add where necessary.
The message transmission is carried out in the mode of data-affirmation, can piggybacking, also can carry out selective acknowledgement.Recipient's buffer memory is not a problem with respect to channel speed usually among the AdHoc, so the control of window size includes only the control of congestion window.The window maximum is 16, and for handling emergency case, the initial value of window is generally 3, and the AIMD strategy is adopted in the adjusting of window, transmits owing to only be used for short message ground, so there is not complicated slow Initiated Mechanism, realizes simple relatively.Owing to do not have recipient's window notice, therefore need not to adhere to chronograph mechanism yet.
2. effect
Common data message head length 8 bytes, data message head length 12 bytes that piggybacking and selection are confirmed, be far smaller than the head expense of 20 bytes of TCP, in the extremely limited Ad Hoc environment of bandwidth, transmit short message, it is considerable improvement that 8 above expenses of byte are saved, and selective acknowledgement and piggybacking have also reduced the message amount of transmission over networks.
The configurability of message is a cost with host process speed.Yet bottleneck is in the network bandwidth rather than host process speed usually in the ad hoc network of low speed, and therefore the network characteristic of using according to reality is come the configuration message form, and the saving network overhead is worth beyond doubt.
Three, sequential event engine and agreement realize
1. sequential event engine
Sequential event engine itself can be divided into two parts: sequential incident unit's engine and specialization sequential event engine.Sequential incident unit engine comprises: 1) event handling function interface, from then on all event handling functions derive from.2) structure of definition incident element, comprise (event id, event category, time-delay, consuming time, ancillary data).Event id herein is independent mutually in different specialization sequential event engines, promptly need not to keep the overall situation consistent.3) incident unit engine is realized all functions except that the specialization event correlation, comprise event registration and withdraw from, and the application incident, resetting event, the opening and closing event loop, thread-safe guarantees, sequential scheduling etc.Specialization sequential event engine comprises: 1) the specialization event interface that derives from from the general purpose event interface has wherein defined event handling function.2), be mainly used in and finish the related of customized event and event handling function from the derivative specialization event engine of incident unit engine.
The use of sequential event engine is extremely simple, derives from and the realization response function from certain specialization event interface, and after the registration of specialization event engine, can be at any time, incident is delivered to the specialization event engine in any place.After the incident of delivering at the appointed time arrives, trigger the event response function of registering, finish the processing procedure of incident by the sequential event engine.
The sequential event engine be the modern times based on the basis of event driven method for designing and Object Oriented method on development and come, the transmission and the time-delay trigger mechanism of complex data are provided, therefore be particularly suitable for the efficient realization of procotol, make the agreement that realizes have efficiently, easy to understand, characteristics such as modification and expansion.
2. adopt the efficient protocols of sequential event engine to realize
As shown in Figure 5, by using the sequential event engine, agreement can be realized being divided into: event engine and overtime administration module, main control module, output module, input module, control table module.The responsibility of each module is described below and how is undertaken alternately by the sequential event engine.
The main body of event scheduling and overtime administration module comprises event engine and an abstract event interface, be responsible for the scheduling of the incident of carrying out and the realization of timeout mechanism, guarantee that all incidents are handled according to the order of sequence, thereby can in a thread, efficiently realize, timer comprises the re-transmission timer, the ack delay timer, input rank idle timer, Synchronization timeout timer.
Main control module is responsible for responding all incidents, and input is called in decision or output module is handled, its specific responsibility comprises: remove connection, carry out state and switch, message is carried out validity checking and preliminary treatment, carry out abnormality processing and improper transfer of data message and handle, filter expired message, mask data and ACK call input module to data and handle, and call output module for ACK and handle.Because main control module is responsible for the parsing of message format, allow the expansion modification of message format only to involve main control module to a certain extent.Equally, because main control module is responsible for the maintenance update and the judgement of message status, have only main control module to know the existence of state, so the change of state machine only may involve main control module.
Output module is responsible for sending data, output queue is operated, its specific responsibility comprises application layer data is added in the right output queue of corresponding socket, attempt the new data within the send window, retransmission time out does not obtain the data of affirmation, send ack, and arrive back slip send window at ack.
Input module is responsible for receiving data, input rank is operated, its specific responsibility comprises to the application layer buffer memory fills the ordered data that receives, and will put into the right input rank of corresponding socket from the data that the IP layer is received, slide receiving window and application time-delay ACK timer.
The control table module comprises socket allocation manager table, and socket for main control module provides support, mainly comprises socket allocation manager table to admin table etc., and socket is to admin table.The data ID of all the address-port that is using two tuples of socket allocation manager table record and binding thereof wherein, raw socket etc.Socket is to address-port two tuples of admin table record receiving-transmitting sides and the transmitting-receiving queue pointer of binding thereof, send window size, receive window position and size, RTT estimated value, states such as RTO size.
Operational mode based on event engine is: input, output, main control module are to the inner overtime incident of event engine application, external application and network layer are delivered external event to event engine, event engine is dispatched incident, trigger overdue incident, call the event response function of main control module registration and handle.
3. effect
Huge switch has been used in the realization of tradition TCP, and conditional branch statements and a large amount of goto statements such as if else make agreement too fat to move, and close coupling is low interior poly-, has both beyonded one's depth, and also is difficult to misarrangement, revises and expansion.Simultaneously, a plurality of timers are difficult to management, have increased the system line number of passes, thereby have increased processing expenditure.The sequential event engine is supported the transmission of complex data, and thread-safe is provided, and has greatly simplified the realization of agreement based on this bottom-up design, makes that the modularization of agreement is higher, and is readable better, and is easy to expansion.Simultaneously, the sequential event engine is incorporated into timer in the event handling system efficiently, thereby has reduced the number of threads of using in the agreement realization, has improved system and has carried out efficient.
Four, message transmission procedure
Fig. 7 has demonstrated a complete message transmission procedure.
1) transmit leg initiate to connect, and (ts), wherein data represents data for data, syn, and syn represents to connect and sets up request flag, and ts=current time+overtime timer regularly to send message.The recipient receive (data, syn, ts) after, take out ts, find ts>current time, so accept message and connect.
2) transmit leg and recipient adopt the data-ack interactive mode to communicate subsequently, are no more than the short message of 3 MTU for size, can once deliver to finish.
3) in the end a bag is after data delivery finishes transmit leg, and (ts), wherein fin represents the connection closed request flag for data, fin, ts=max (current time connects the time stamp that comprises in the last syn message that sends) can to send the connection closed request.After the recipient received turn-off request, record ts was to tints, and started the pass closed procedure, closed connection constantly in certain that is no earlier than fmts.
The processing procedure of agreement during syn message that Fig. 8 has demonstrated is expired when occurring, repeat.
1) in the t1 moment, the transmit leg request connects, and (t2), wherein t2 is the delivery time of next bag syn for data, syn to send syn1.
2) in the t2 moment, transmit leg is overtime, and request connects again, and (t3), wherein t3 is the delivery time of the 3rd syn for data, syn to send syn2.
3) t2~t3 period, connect smoothly and set up, and pay data, but do not have ack to return.
4) in the t3 moment, transmit leg is overtime once more, and (t4), wherein t4 is the delivery time of the 4th syn for data, syn to send syn3.
5) t3~t4 period, ack returns, and all data are identified, and connects smoothly subsequently to stop.
6) in the t4 moment, recipient's time-delay closing timer expired is closed connection smoothly.
7) afterwards, syn1 is late, because syn1 is constantly promptly out-of-date as far back as t2, so the side's of being received refusal.
8) last, syn3 arrives and since syn3 at t4 constantly promptly with overtime, the therefore side's of being received refusal.
Five, the realization of state machine
Protocol state machine as shown in Figure 6.
Suggestion uses the state Design Mode to realize state machine, and every operation relevant with state all uses state that it is decentralized, can simplify the realization of agreement, and is easy to expand.Shown in state-event response is listed as follows:
State-event response tabulation 1
Incident Recv ack Recv data FIN FIN-ACK
Normal Transfer output module Transfer input module Send fin-ack, switch to closeWait Mistake
Fin1 Transfer output module Transfer input module Send fin-ack, switch to Closing To Fin2
Closing Transfer output module Application time-delay ack Do not handle To TimedWait
Fin2 Do not handle Transfer input module Send fin-ack, switch To TimedWait Do not handle
TimeWait Do not handle Application time-delay ack Do not handle Do not handle
closeWait Transfer output module Application time-delay ack Do not handle Mistake
LastAck Transfer output module Application time-delay ack Do not handle To Closed
Closed Do not handle Application time-delay ack Do not handle Do not handle
State-event response tabulation 2
Incident close dataPut
Normal Call output module OnClose, enter the Fin1 state Call output module
Fin1 Do not handle (mistake: repeat to close) Do not handle: close
Closing Do not handle (mistake: repeat to close) Do not handle: close
Fin2 Do not handle (mistake: repeat to close) Do not handle: close
TimeWait Do not handle (mistake: repeat to close) Do not handle: close
closeWait Call output module OnClose, enter the LastAck state Call output module
LastAck Do not handle (mistake: repeat to close) Do not handle: close
Closed Do not handle (mistake: repeat to close) Do not handle: close
State-event response tabulation 3
Overtime Retransmission time out ACK is overtime in time-delay TIME-WAIT is overtime Time-delay closing is overtime
Normal Call output module Call input module Mistake Be provided with and allow to close
Fin1 Call output module Call input module Mistake Be provided with and allow to close
Closing Call output module Call input module Mistake Be provided with and allow to close
Fin2 Do not handle Call input module Mistake Be provided with and allow to close
TimeWait Do not handle Call input module Switch to Closed Be provided with and allow to close
closeWait Call output module Call input module Mistake Be provided with and allow to close
LastAck Call output module Call input module Mistake Be provided with and allow to close
Closed Do not handle Call input module Mistake Close connection
The internal event explanation:
Internal event is to be judged by main control module, and only triggers the time once, is described in detail as follows:
1) receives the FIN incident: receive that separately FIN can't trigger this incident, has only when FIN is moved out of input window and just can trigger.In addition, receive FIN when not having input rank, also can trigger this incident.Its meaning of one's words has all successfully been received for all data, does not after this allow to receive any data (also invalid in the input window).Such state comprises CLOSING, TIMED-WAIT, CLOSED, CLOSE-WAIT, LASTACK.
2) receive the FIN-ACK incident: the bag of FIN triggers (judging after the OnAck) when output queue shifts out.Its meaning of one's words has all successfully been delivered to for all data, does not after this allow to send any data.Such state comprises FIN-WAIT2, TIMED-WAIT, CLOSED.
Points for attention:
1) if having reception FIN incident simultaneously and receive the FIN-ACK incident, MainModule carries out the processing of FIN incident earlier, carries out the processing of FIN-ACK incident again, does not therefore have FIN-WAITl directly to arrive the conversion of TIMED-WAIT.
2) if having data and ack simultaneously, then handle data earlier, handle ack again.
3) FIN and FIN-ACK incident are handled after data.ack.
4) italic represents to have the process of entering.The process that enters that wherein switches to TimedWait is overtime timer of TimedWait of application.The process of entering that switches to Closed is: if allow to close, then apply for a 0ms close the time-delay overtime.
5) call send, if this four-tuple does not exist, a then newly-built connection enters the NORMAL state.
6) client can not send fin before syn is identified, and syn was identified after this meaning person fin sent, and was not sent out so do not have new syn after the fin transmission, and by the meaning of one's words of fin-ts, the fin message of all transmissions, its fin-ts are all the same.If therefore receive the fin message of repetition, simple filtration gets final product, and need not to carry out any operation bidirectional (as replacement fin-wait timer and allowclose mark).
7) Close-wait is overtime is receiving that FIN (being different from the FIN incident) applies for that afterwards the process that enters of Closed also may be applied for for the first time by MainModule.
8) process that enters of Closed is by applying for closing time-delay but not directly close and connect discharging resource of a 0ms, is to consider for the integrality that the state pattern enters process.Otherwise in the process of entering resource is discharged, state thereafter switches just becomes meaningless the operation.And this design is called all resource release in the closed timeout treatment process that has focused on closed, helps the distinct and resource management of structure.
Six, other preferred agreement implementation
1. connection closed process
Have multiple scheme can realize time-delay closing, it is better to provide a kind of encapsulation here, more succinct mode.
Do not deposit in the connection and finish time stamp fin-ts, deposit allowclose and represent to allow to close, and be initialized as false.Main control module applies now a close-WAIT after receiving FIN overtime, and time-out time still adopts top mode to calculate.After the overtime generation of close-WAIT (state that may respond comprises all states), the allowclose in connecting is changed to true.In the process that enters and FIN-WAIT response process of CLOSED state,, then close connection if allowclose is true.
2. the realization of event engine
The suggestion use realizes the event queue of sequential event engine based on the Priority Queues structure of heap, thereby can the assurance incident insert and take out the high efficiency of operating.
In the realization, should consider the delivery once more of the incident that in the invoked procedure that carries out event handling function, may take place, should think over thread-safe and synchronizing process, avoid the appearance of deadlock.
3. on IP, realize agreement
Be guaranteed efficiency, use raw socket on IP, directly to realize agreement.For fear of the great expense incurred of each establishment socket, in the environment that allows a plurality of IP, raw socket should be put into connection and preserve.The responsibility of raw socket only limits to the transmission of data, therefore just there is no need to use extra thread.All reception operation is handled by a bottom watcher thread, carries out the distribution of data then, connection search coupling, these work are finished by main control module.
4. simplify number of threads
For guaranteeing the system high efficiency reliable operation, thread is few more good more.Therefore, except user thread, have only event handling thread and bottom receiving thread.Wherein the event handling thread is responsible for the realization of main body logic, and all operations is operated by the serialization of event handling thread.The bottom receiving thread is responsible for monitoring the bottom channel, obtains required message.
Based on the consideration of efficient, just can start event handling thread and bottom receiving thread when having only the socket of existence, therefore there is the dynamic generation of these two threads and withdraws from process, this process should design a class, encapsulates as the Daemon class.
5. duplication technology
Though have copy in theory 0 time, this mode is unfavorable for separating of consumer process and system process, make design complicated, make mistakes easily (even require user's synchronized transmission data, can't handle the situation that network interrupts).Therefore 1 duplication technology is adopted in suggestion, is keeping the succinct open-ended while of design, makes data copy number of times reach minimum.
When data sent, data only copied in the output queue adding fashionable being copied, and when data obtained confirming that back or output queue destructor function call, the output queue node was deleted, and its destructor function is responsible for discharging memory space.When Data Receiving, data only copy to when receiving in the message that bottom data arrives, data taken away by the user or input rank when analysing structure the input rank node deleted, its destructor function is responsible for discharging memory space.
For realizing once copy, must partly open message format to the bottom receiver function, so that user data is therefrom separated and copied in the new memory space.Bottom receiver function initiate a message (head, data, source IP, order IP), wherein release is responsible for by main control module in the space of head, and when there was input rank deletion input rank node in the space of data after analysing structure from input rank or taking out data, its destructor function was responsible for release.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to and replaces and improve, and all should be included within protection scope of the present invention.

Claims (11)

1. transmit the method for data in the Ad Hoc network reliably, realize reliable transmission, it is characterized in that may further comprise the steps by syn, ack and fin message:
A. transmit leg initiate to connect, and (syn-ts1), wherein data represents data for data, syn, and syn represents to connect and sets up request flag, and syn-ts1=current time+overtime timer regularly is the overtime retransmission time of this message to send message syn1;
B. the recipient receive syn1 (data, syn, syn-ts1) after, take out syn-ts1, if syn-ts1>current time is then accepted message and connected, otherwise refusal connects;
C. transmit leg and recipient adopt the data-ack interactive mode to communicate subsequently;
D. a transmit leg bag after data delivery finishes in the end, can send connection closed request message fin (data, fin, fin-ts), wherein data represents data, and fin represents the connection closed request flag, fin-ts=max (current time, connect the time stamp that comprises in the last syn message that sends), for the concluding time stabs;
E. after the recipient receives turn-off request, start to close closed procedure, close connection constantly in certain that is no earlier than fin-ts.
2. the method for claim 1, it is characterized in that further may further comprise the steps: if constantly successfully do not connect as yet at syn-ts1, transmit leg then is judged as and sends message syn1 (data, syn, syn-ts1) overtime, and syn-ts1 send constantly syn2 (data, syn, syn-ts2), again request connects, wherein syn-ts2=current time+overtime timer regularly, it be transmit leg overtime after, the delivery time of next syn message.
3. method according to claim 1, it is characterized in that: also comprise syn-no and fin-no parameter in syn and the fin message respectively, wherein syn-no is an initial sequence number, generates according to hardware clock, fin-no is an end sequence number.
4. method according to claim 1, it is characterized in that: contain it in the ack message and confirm the pairing sequence number of data, when ack returned, all data that sent before the data of its affirmation all were identified.
5. method according to claim 1, it is characterized in that: the recipient starts the passive open process after receiving the syn message, if receive message syn (syn-no, data, syn, moment syn-ts) is now, the sequence number if now>syn-ts or connection exist among last ack is greater than syn-no, then refuse this message, otherwise receive and newly-built connection.
6. as method as described in the claim 5, it is characterized in that: the recipient receive message fin (fin-no, data, fin, fin-ts) back starts passive pass closed procedure, if this moment now>fin-ts constantly, remove and connect, otherwise remove connection constantly at fin-ts.
7. as the described method of one of claim 1 to 6, it is characterized in that: be no more than the short message of 3 MTU for size, can once deliver and finish.
8. as the described method of one of claim 1 to 6, it is characterized in that: this method is replaced Transmission Control Protocol, realizes on the IP agreement.
9. as the described method of one of claim 1 to 6, it is characterized in that: this method adopts 1 duplication technology.
10. as the described method of one of claim 1 to 6, it is characterized in that: described message comprises source port, destination port, type, Head len, Reserved, Seq#, Additional Header and Data field, wherein:
Source port and destination port respectively account for 16, represent source port and destination interface respectively;
Type accounts for 8, and everybody is followed successively by SYN, FIN, and ACK, SACK, TS, CS keeps 2, represents start message respectively, end message, piggybacking is incidentally selected to confirm, has verification, has time stamp; FIN can not be with data, and SYN, FIN can not occur simultaneously, and TS occurs simultaneously with SYN, FIN only, and SYN, FIN can carry data, and the difference of its meaning of one's words and TCP is to have only REQUEST that SYN, FIN can be set, and ACCEPT can not be provided with SYN, FIN;
Head len is a head length, is that unit counts with the double byte, thus head the longest be the 15*2=30 byte;
Reserved is a reserved field;
Seq# is the window sequence number, and at relatively low channel speed, sequence number uses 2 bytes;
Additional Header comprises 16 ACK at present, 16 Checksum, 32 time stamps and 16 SACK, ACK represents to expect the sequence number of next bag, and is the same with sequence number, and its length is 2 bytes, SACK represents the receive window state of [ACK, ACK+16], and first always is 0; TS represents time stamp, can its mask precision be set by connecting, and this is only for this locality; CS be verification and, can be by connect being provided with; Checksum is a checksum field.
11. as the described method of one of claim 1 to 6, it is characterized in that: use less thread when realizing this method as far as possible, except user thread, have only event handling thread and bottom receiving thread, wherein the event handling thread is responsible for the realization of main body logic, all operations is by event handling thread serialization operation, and the bottom receiving thread is responsible for monitoring the bottom channel, obtains required message.
CNB2007100797625A 2007-03-09 2007-03-09 Reliable transfer method of short message in the ad hoc network Expired - Fee Related CN100505663C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007100797625A CN100505663C (en) 2007-03-09 2007-03-09 Reliable transfer method of short message in the ad hoc network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007100797625A CN100505663C (en) 2007-03-09 2007-03-09 Reliable transfer method of short message in the ad hoc network

Publications (2)

Publication Number Publication Date
CN101018176A true CN101018176A (en) 2007-08-15
CN100505663C CN100505663C (en) 2009-06-24

Family

ID=38726941

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007100797625A Expired - Fee Related CN100505663C (en) 2007-03-09 2007-03-09 Reliable transfer method of short message in the ad hoc network

Country Status (1)

Country Link
CN (1) CN100505663C (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011079743A1 (en) * 2009-12-30 2011-07-07 深圳市同洲电子股份有限公司 Data transmission method and associated devices
CN102457980A (en) * 2010-10-14 2012-05-16 中国移动通信集团公司 Data transmission method and system in sensor network
CN105827439A (en) * 2016-03-11 2016-08-03 上海动康医疗技术有限公司 Method for realizing wireless device ad hoc network
CN106533603A (en) * 2016-12-20 2017-03-22 创新科存储技术有限公司 Time synchronizing method and device for distributed system
CN107809757A (en) * 2017-10-31 2018-03-16 贵州力创科技发展有限公司 A kind of 4G sector applications card detecting system and method
CN112737914A (en) * 2020-12-28 2021-04-30 北京天融信网络安全技术有限公司 Message processing method and device, network equipment and readable storage medium
CN113489574A (en) * 2021-07-13 2021-10-08 上海睿赛德电子科技有限公司 Communication protocol used between multiple groups of application services of double computers in embedded system
CN113687686A (en) * 2021-08-10 2021-11-23 北京小米移动软件有限公司 Clock synchronization method and device, electronic equipment and storage medium
CN113791901A (en) * 2021-08-31 2021-12-14 上海弘积信息科技有限公司 Efficient TCP retransmission implementation method for load balancing equipment
CN114785464A (en) * 2022-06-20 2022-07-22 希诺麦田技术(深圳)有限公司 Automatic data retransmission method and application of wireless ad hoc network
CN114785870A (en) * 2022-04-06 2022-07-22 浙江大学 Optimization method for TCP/IP and BLE integrated protocol stack

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4064944B2 (en) * 2003-04-26 2008-03-19 三星電子株式会社 Apparatus and method for data packet retransmission in a mobile ad hoc network environment
US7417962B2 (en) * 2004-09-15 2008-08-26 Alcatel Lucent QoS capable mobile ad-hoc network device

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011079743A1 (en) * 2009-12-30 2011-07-07 深圳市同洲电子股份有限公司 Data transmission method and associated devices
CN102457980A (en) * 2010-10-14 2012-05-16 中国移动通信集团公司 Data transmission method and system in sensor network
CN102457980B (en) * 2010-10-14 2014-07-02 中国移动通信集团公司 Data transmission method and system in sensor network
CN105827439A (en) * 2016-03-11 2016-08-03 上海动康医疗技术有限公司 Method for realizing wireless device ad hoc network
CN105827439B (en) * 2016-03-11 2019-02-01 范晓东 The method for realizing wireless device ad hoc network
CN106533603A (en) * 2016-12-20 2017-03-22 创新科存储技术有限公司 Time synchronizing method and device for distributed system
CN107809757A (en) * 2017-10-31 2018-03-16 贵州力创科技发展有限公司 A kind of 4G sector applications card detecting system and method
CN107809757B (en) * 2017-10-31 2021-01-22 贵州力创科技发展有限公司 4G industry application card detection system and method
CN112737914A (en) * 2020-12-28 2021-04-30 北京天融信网络安全技术有限公司 Message processing method and device, network equipment and readable storage medium
CN112737914B (en) * 2020-12-28 2022-08-05 北京天融信网络安全技术有限公司 Message processing method and device, network equipment and readable storage medium
CN113489574A (en) * 2021-07-13 2021-10-08 上海睿赛德电子科技有限公司 Communication protocol used between multiple groups of application services of double computers in embedded system
CN113687686A (en) * 2021-08-10 2021-11-23 北京小米移动软件有限公司 Clock synchronization method and device, electronic equipment and storage medium
CN113687686B (en) * 2021-08-10 2024-05-14 北京小米移动软件有限公司 Clock synchronization method, clock synchronization device, electronic equipment and storage medium
CN113791901A (en) * 2021-08-31 2021-12-14 上海弘积信息科技有限公司 Efficient TCP retransmission implementation method for load balancing equipment
CN113791901B (en) * 2021-08-31 2023-12-26 上海弘积信息科技有限公司 Efficient TCP retransmission realization method for load balancing equipment
CN114785870A (en) * 2022-04-06 2022-07-22 浙江大学 Optimization method for TCP/IP and BLE integrated protocol stack
CN114785870B (en) * 2022-04-06 2024-01-19 浙江大学 TCP/IP and BLE integrated protocol stack oriented optimization method
CN114785464A (en) * 2022-06-20 2022-07-22 希诺麦田技术(深圳)有限公司 Automatic data retransmission method and application of wireless ad hoc network
CN114785464B (en) * 2022-06-20 2022-09-02 希诺麦田技术(深圳)有限公司 Automatic data retransmission method and application of wireless ad hoc network

Also Published As

Publication number Publication date
CN100505663C (en) 2009-06-24

Similar Documents

Publication Publication Date Title
CN100505663C (en) Reliable transfer method of short message in the ad hoc network
CN101505306B (en) Inter-node reliable communication method in distributed system
CN103036904B (en) A kind of udp protocol that uses in a communication network carries out the method for reliable data transmission
DE69233608T2 (en) Local radio frequency network
CN101052043B (en) TCP sending algorithm based on sending window and reciprocating time
CN102237718B (en) Method and device of operating wind power electric field power network with improved data transmission protocol
CN104202774A (en) Reliable and real-time industrial wireless local area network transmission method
CN101436978A (en) Method for authentic data transmission using UDP protocol
CN103731409B (en) The distributed measurement device of embedded type automobile acquisition equipment for accelerating with TCP
CN101502065A (en) Methods for providing quality of service by applying back-pressure in sequencing
CN102291389A (en) Cross-layer congestion control method in satellite network
CN109995675A (en) A kind of adaptive industrial ethernet gateway System and method for based on software definition
CN100394717C (en) Base station TCP agency confirmation method based on ARQ information and its system
CN101110767A (en) Accelerating method for asymmetric and multi-concurrency network
CN101719876B (en) Network communication dispatching method and system
CN101018195B (en) Transmission method of burst message in the MANET information distribution ordering platform
CN101778093A (en) UDP (User Datagram Protocol) based data transmission method
CN101212401A (en) Grid-oriented configurable data transmission method and system
Doshi et al. Error and flow control performance of a high speed protocol
CN103957121A (en) Cross-layer TCP optimization method oriented to aerospace information network
WO2023015644A1 (en) Planning method and system architecture for scheduling of chained service flow
CN101651676A (en) Online download method for large data volume files
CN103051560A (en) Implementation method for retransmitting and controlling congestion control in separating system
US20120117204A1 (en) Method for Automatically Negotiating Type of Service and Aggregation Apparatus Therefor
CN100405785C (en) Method for processing of double layer channel protocol message and apparatus thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090624

Termination date: 20110309