Summary of the invention
In view of this, the application provides a kind of processing method and device of network data, and to realize when paroxysmal network data blocks generation, receiving terminal can carry out real-time statistics to the data be rejected and feed back to transmitting terminal.
To achieve these goals, a kind of processing method of network data that provides of the application is as follows:
A processing method for network data, is applied in the data transmission network with transmitting terminal and receiving terminal, comprises:
Extract the identification information in the network data that described receiving terminal gives up;
The total quantity of the network data given up described in statistics;
Described identification information and described total quantity are sent back to described transmitting terminal.
Preferably, the identification information in the network data that the described receiving terminal of described extraction is given up, specifically comprises:
Judge whether the first buffer of described receiving terminal is filled with;
If described first buffer is filled with, extract the identification information of the network data in described first buffer, by described identification information separately stored in the second buffer of correspondence, and by described first buffer empties.
Preferably, the total quantity of the network data given up described in described statistics, specifically comprises:
Calculate the quantity of the described identification information preserved in described second buffer;
Judge whether described quantity is less than default threshold value;
If described quantity is not less than described default threshold value, by described zeroing number, and carry, preserve quantity carry value;
If described quantity is less than described default threshold value, judge whether described transmitting terminal terminates to send;
If described transmitting terminal does not terminate to send, wait for that described transmitting terminal continues to send;
If described transmitting terminal terminates to send, in conjunction with the total quantity of the network data given up described in the quantity of the described identification information preserved in described second buffer and described quantity carry value statistics.
Preferably, described described identification information and described total quantity are sent back to described transmitting terminal, specifically comprise:
If described quantity is not less than described default threshold value, the described identification information preserved in described second buffer is sent back to described transmitting terminal;
If described transmitting terminal terminates to send, the total quantity of the described network data given up is sent back to described transmitting terminal.
Preferably, before the identification information in the network data that the described receiving terminal of extraction is given up, also comprise:
Receive the network data from described transmitting terminal and be saved in memory;
Extract the length information of the network data in described memory, routing iinformation, temporal information, sequence identifier and data message and another stored in the first buffer of correspondence.
Preferably, if described first buffer is not filled with, also comprise:
Judge whether the network data in described first buffer belongs to control command;
If the network data in described first buffer belongs to control command, resolve described control command and according to analysis result perform described control command require action;
If the network data in described first buffer does not belong to control command, by the network data in described first buffer separately stored in doing further process in transmit buffer.
Preferably, described identification information is temporal information in network data and sequence identifier.
The application also provides a kind of processing unit of network data:
A processing unit for network data, be applied in the data transmission network with transmitting terminal and receiving terminal, described receiving terminal comprises:
For extracting the extraction unit of the identification information in network data that described receiving terminal gives up;
For the counting unit of the total quantity of network data given up described in adding up;
For described identification information and described total quantity being sent back to the feedback unit of described transmitting terminal.
Preferably, described receiving terminal also comprises:
Be connected with described extraction unit, for preserving the memory of the network data from described transmitting terminal;
Be connected with described memory with described extraction unit respectively, for preserving the first buffer of the length information of network data, routing iinformation, temporal information, sequence identifier and data message in described memory that described extraction unit extracts;
Be connected with described first buffer with described extraction unit respectively, for preserving the second buffer of the identification information of the network data in described first buffer of described extraction unit extraction;
For judging whether described first buffer has been filled with and has judged whether the quantity of the described identification information preserved in described second buffer is less than default threshold value and judges whether described transmitting terminal terminates send and judge whether the network data in described first buffer belongs to the judging unit of control command.
Preferably, described receiving terminal also comprises:
Be connected with described first buffer, for resolving the network data belonging to control command in described first buffer and performing the resolution unit of the action that described control command requires according to analysis result;
Be connected with described first buffer, for preserving the network data that do not belong to control command in described first buffer and doing the transmit buffer of process further.
The technical scheme provided from above the application, the attainable beneficial effect of the application is as follows:
1, by the technical scheme that application the application provides, when transmitting terminal occurs that the outburst of paroxysmal network data causes the transfer of data in network to occur to block, receiving terminal can by the reception in buffer but untreated network data give up, clean out buffer space to receive follow-up data, real-time statistics can be carried out to the data be rejected simultaneously, the identification information of the data be rejected of extraction and the total quantity of the data be rejected of calculating are fed back to transmitting terminal and does further process, avoid maintenance and research staff there is misoperation because not knowing which data to be dropped at receiving terminal.
2, the application Technical Design of providing multiple buffer or memory, can receive to greatest extent from transmitting terminal data and shift the data that need give up in time, receiving terminal is when feeding back to transmitting terminal the data be rejected simultaneously, the data bandwidth maximum of load or the buffer depth situation of receiving terminal the max-thresholds of the data volume that once feedback can send can be preset according to network, this makes it possible to utilize the network bandwidth to greatest extent, avoid the waste of resource.
Embodiment
Technical scheme in the application is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
Embodiment one:
The schematic flow sheet of the processing method of a kind of network data that Fig. 1 provides for the embodiment of the present application.
In the embodiment of the present application, network data sends to receiving terminal primarily of transmitting terminal.
With reference to shown in Fig. 1, the method comprises the following steps:
S100: the identification information in the network data that extraction receiving terminal is given up.
In the prior art, receiving terminal gives up network data at random, can't carry out record to given up network data.
In the embodiment of the present application, receiving terminal can extract the identification information in the network data needing to give up, here identification information is can the proprietary information of every bar network data of characterizing network data identity, why to extract identification information instead of preserve network data itself, consider for the space and network bandwidth resources of saving receiving terminal buffer, be not preserve the object that network data inherently can not reach the application, so under the condition ignoring receiving terminal buffer space and network bandwidth resources impact, identification information herein also can be understood as the network data itself that this identification information characterizes.
In addition, extraction identification information is the action for needing the network data given up, when data transmission network blocks, receiving terminal needs to give up the transmission that a part of network data just can keep network, and will ensure not cause random loss to get rid of bag to the feedback of transmitting terminal, the identification information in the network data needing to give up will be extracted, be equivalent to record and given up which network data.
The idiographic flow schematic diagram of the method for the identification information in the network data that Fig. 2 gives up for the described receiving terminal of extraction that the embodiment of the present application provides.
With reference to shown in Fig. 2, giving up network data and extracting the process of identification information here can in the following ways:
S101: judge whether the first buffer of receiving terminal is filled with.
In the embodiment of the present application, receiving terminal can arrange multiple buffer, just think that when the first buffer is filled with the data in network exist obstruction according to the network bandwidth and buffer depth-set simultaneously, because according to the network bandwidth and buffer depth-set, so when working properly, first buffer can maintain turnover balance, but when network data is blocked, first buffer can fill up by data very soon that receive, now buffer can provide a full flag bit, and prompting has reached full state.
S102: if the first buffer is filled with, extract the identification information of the network data in the first buffer, by identification information separately stored in the second buffer of correspondence, and by the first buffer empties.
It should be noted that, the first buffer herein and the second buffer can be buffer group, the buffer of multiple par often can be set among group, " first " and " second " is herein just for the ease of distinguishing the respective function of buffer, and be not used in any restriction is done to the quantity of buffer, in actual applications, all buffers here can select First Input First Output buffer FIFO, also can adopt the memory of other types.
In addition, here, identification information can be a kind of, the sequence identifier of such as network data or temporal information, also can be two or more, the sequence identifier of such as network data and temporal information, when identification information is two or more, two or more can thinking here are one group, the identification information being all one group characterizes a network data simultaneously, and the identification information being all a group can be kept in the different buffers in the second buffer group, one_to_one corresponding is considered as an identification information jointly, also can be kept in units of group in identical buffer, be considered as an identification information.
When the first buffer is filled with, think there is obstruction in network, the new data from the follow-up transmission of transmitting terminal now cannot be received in the first buffer again, so need to empty the first buffer, follow-up data could be received, maintenance network is unimpeded, and namely the network data be cleared in the first buffer is considered to the network data given up, needs to be extracted by their identification information before emptying separately to be further processed stored in the second buffer.
S200: the total quantity of adding up the network data given up.
In the embodiment of the present application, in order to prevent packet loss or get rid of in packet procedures to transmitting terminal feedback data omit to some extent, while the identification information extracting the network data be rejected, the total quantity of the network data be rejected can be added up simultaneously, the relatively number of identification information and the total quantity of statistics gained, just can check out and whether lost network data, more can guarantee accuracy and the reliability of feedack.
The idiographic flow schematic diagram of the method for the total quantity of the network data given up described in the statistics that Fig. 3 provides for the embodiment of the present application.
With reference to shown in Fig. 3, in the embodiment of the present application, the method for adding up the total quantity of the network data given up can be:
S201: the quantity calculating the identification information preserved in the second buffer.
Here, the identification information that the second buffer is preserved is exactly the identification information in the network data needing to give up, and all unique corresponding network data of every bar identification information.
S202: judge whether the quantity of identification information is less than default threshold value.
Here threshold value can according to the depth-set of network bandwidth data payload maximum and buffer.
S203: if the quantity of identification information is not less than default threshold value, by this zeroing number, and carry, preserve quantity carry value.
Because threshold value is according to the depth-set of network bandwidth data payload maximum and buffer, so when the quantity of identification information is not less than default threshold value, show that the quantity of the identification information preserved in now the second buffer has reached the portative data maximums of the network bandwidth, now with regard to needs, all identification informations are sent back to transmitting terminal to carry out having fed back, but after identification information sends, in order to again count the follow-up new identification information received that needs, now just original count value should be reset, in order to add up the identification information total quantity repeatedly beaming back feedback, magnitude carry is preserved carry value simultaneously, the total quantity of all identification informations repeatedly altogether beamed back to transmitting terminal is so just gone out by the real-time identification information quantity statistics in the product of carry value and threshold value and the second buffer.
S204: if the quantity of identification information is less than default threshold value, judges whether transmitting terminal terminates to send.
When the quantity of the identification information in the second buffer is less than threshold value, not yet reach the data payload maximum of the network bandwidth, now in order to make full use of the network bandwidth, save Internet resources, when transmitting terminal continues to send data, need to continue to receive the ident value of network data that need give up, until stored in quantity reach threshold value, therefore now identification information should not sent back to transmitting terminal, but should judge whether transmitting terminal sends end.
S205: if transmitting terminal does not terminate to send, waits for that transmitting terminal continues to send.
When the quantity of the identification information in the second buffer is less than threshold value, not yet reach the data payload maximum of the network bandwidth, now in order to make full use of the network bandwidth, save Internet resources, when judging that transmitting terminal continues to send data, need to continue to receive the ident value of network data that need give up, until stored in quantity reach threshold value.
S206: if transmitting terminal terminates to send, add up the total quantity of the network data given up in conjunction with the quantity of the identification information preserved in the second buffer and quantity carry value.
At the end of judging that transmitting terminal sends, whether be filled with regardless of in the second buffer, all identification information should be sent back to transmitting terminal to feed back, and the total quantity of the network data be rejected is sent back to transmitting terminal, the total quantity of network data here can obtain by the method for the identification information quantitative value in carry value × threshold value+current second buffer simultaneously.
S300: identification information and total quantity are sent back to transmitting terminal.
After the identification information in the second buffer reaches threshold value, receiving terminal needs identification information to send back to transmitting terminal, when judging that transmitting terminal has stopped sending data, receiving terminal also needs the total quantity of the network data be rejected counted to send back to transmitting terminal, these are as the feedback of the network data that will be rejected to transmitting terminal, then transmitting terminal can be for further processing according to received feedback, here next step process can be that the data that received terminal transmitting terminal identified is given up retransmit when network is unobstructed, or the network data be rejected is shown, maintenance and research staff can be understood has be rejected at receiving terminal for which network data, to carry out follow-up attended operation etc., but next step process here has more than and is limited to action recited above.
The idiographic flow schematic diagram of the method for described transmitting terminal that described identification information and described total quantity are sent back to that Fig. 4 provides for the embodiment of the present application.
With reference to shown in Fig. 4, in the embodiment of the present application, the method described identification information and described total quantity being sent back to described transmitting terminal here can be:
S301: if the quantity of identification information is not less than default threshold value, the identification information preserved in the second buffer is sent back to transmitting terminal.
Because threshold value is according to the depth-set of network bandwidth data payload maximum and buffer, so when the quantity of identification information is not less than default threshold value, show that the quantity of the identification information preserved in now the second buffer has reached the portative data maximums of the network bandwidth, now not only need the zeroing number of the identification information in the second buffer and carry and preservation carry value, also need that all identification informations of correspondence are sent back to transmitting terminal and feed back.
S302: if transmitting terminal terminates to send, the total quantity of the network data given up is sent back to transmitting terminal.
At the end of judging that transmitting terminal sends, whether the identification information regardless of the network data be rejected in the second buffer is filled with, all identification information should be sent back to transmitting terminal to feed back, and after the identification information feedback in the second buffer is returned transmitting terminal, because transmitting terminal stopped this process of transmitting, the total quantity of the network data simultaneously this be rejected also is needed to send back to transmitting terminal, the total quantity of network data here can obtain by the method for " the identification information quantitative value in carry value × threshold value+current second buffer ".
In addition, after all processes finishes, receiving terminal can also be ready to wait for that transmitting terminal sends network data again to receiving terminal again.
Embodiment two:
Fig. 5 for the embodiment of the present application provide at the schematic flow sheet extracting the method before the identification information in the network data given up of described receiving terminal.
With reference to shown in Fig. 5, the application, on the basis of above-described embodiment, before the identification information in the network data can also given up, can also arrange following steps at extraction receiving terminal:
S001: receive the network data from transmitting terminal and be saved in memory.
In the embodiment of the present application, receiving terminal is except the first buffer and the second buffer, also comprise memory, first the network data that transmitting terminal issues receiving terminal preserves in memory, memory herein can realize the function of buffers network data transmission, to the smoothing process of the transmission of network data, to avoid occurring excessive shake, the network bandwidth can be utilized to greatest extent simultaneously, avoid the phenomenons such as the waste of data resource and occur.
S002: extract the length information of the network data in memory, routing iinformation, temporal information, sequence identifier and data message and another stored in the first buffer of correspondence.
When receiving terminal is provided with memory, first buffer can be used for preserving the length information in the network data of reception extracted from memory, routing iinformation, temporal information, the information of sequence identifier and data message or other type, the follow-up process for network data only needs to extract corresponding information from the first buffer, here the first buffer can realize the function of buffers network data transmission equally, to the smoothing process of the transmission of network data, to avoid occurring excessive shake, the network bandwidth can be utilized to greatest extent simultaneously, avoid the phenomenons such as the waste of data resource to occur.
It should be noted that, the first buffer herein can be buffer group, the buffer of multiple par can be set in group, " first " is herein just for the ease of distinguishing the respective function of buffer, and be not used in any restriction is done to the quantity of buffer, in actual applications, buffer here can select First Input First Output buffer FIFO, also can adopt the memory of other types.
In addition, here, the length information of network data, routing iinformation, temporal information, sequence identifier and data message, one group of information of consolidated network data can be thought, characterize this network data simultaneously, and the information being all one group can be kept in same buffer in units of group, also can be kept at correspondingly respectively in the different buffers of the first buffer group, not repeat them here.
Embodiment three:
If the schematic flow sheet of the method that described first buffer that Fig. 6 provides for the embodiment of the present application is not filled with.
With reference to shown in Fig. 6, on the basis of the above-described embodiment provided in the application, if the embodiment of the present application additionally provides method when the first buffer is not filled with, step is as follows:
S103: judge whether the network data in the first buffer belongs to control command.
The network data that receiving terminal receives may comprise the data control command of receiving terminal and needs being supplied to other equipment by receiving terminal, therefore, when network data buffers into after in the first buffer, receiving terminal needs judgement to be which kind of data, to be for further processing.
S104: if the network data in the first buffer belongs to control command, resolves control command and the action required according to analysis result execution control command.
If through judging that certain data in confirmation first buffer are control command, then can these data of extracting directly, control command is resolved, according to the requirement execution control action of control command.
S105: if the network data in the first buffer does not belong to control command, by the network data in the first buffer separately stored in doing further process in transmit buffer.
If through judging that certain data in confirmation first buffer are not control commands, then can think that this network data needs to be sent to other ports, then can extract the every terms of information of the network data in the first buffer, according to the requirement structure bag again of network frame, according to the routing iinformation in network data, these data are sent to the device port of specifying.
Embodiment four:
The structural representation of the processing unit of a kind of network data that Fig. 7 provides for the embodiment of the present application.
With reference to shown in Fig. 7, the application also provides a kind of processing unit of network data, and this device is provided with transmitting terminal 1 and receiving terminal 2, transmitting terminal 1 sends network data to receiving terminal 2, the network data given up is fed back to transmitting terminal 1 by receiving terminal 2, and wherein, receiving terminal 2 comprises:
For extracting the extraction unit 21 of the identification information in network data that receiving terminal gives up.
In the embodiment of the present application, here identification information is temporal information and/or the sequence identifier of network data, based in other embodiment of the application, identification information can be other type can the narrow spectrum information of characterizing network data, simultaneously, here extraction unit 21 not only can extract the identification information in network data, out of Memory such as length information, routing iinformation and the data message etc. in network data can be extracted equally, extract principle identical with the principle extracting identification information, for existing mature technology, repeat no more herein.
For adding up the counting unit 22 of the total quantity of the network data given up.
In the embodiment of the present application, here counting unit 22 not only can calculate the quantity of current existing identification information in the buffer of receiving terminal 2, the quantity of the network data be namely rejected in current procedures, clearing can also be carried out and carry to the identification information quantity of current preservation itself after receiving terminal 2 beams back identification information to transmitting terminal 1, and preservation carry value, so that the total quantity of the network data be altogether rejected in the transmission of the whole network data of subsequent statistical and process of transmitting, the total quantity of network data here can obtain by the method for " the identification information quantitative value in carry value × threshold value+current second buffer ".
For identification information and total quantity being sent back to the feedback unit 23 of transmitting terminal.
In the embodiment of the present application, after the identification information in receiving terminal 2 reaches threshold value, receiving terminal 2 needs identification information to send back to transmitting terminal, counting unit 22 is understood the zeroing number of the identification information in receiving terminal and carry and preservation carry value simultaneously, when judging that transmitting terminal 1 has stopped sending data, receiving terminal 2 also needs the total quantity of the network data be rejected counting unit 22 counted to send back to transmitting terminal 1, and these are as the feedback of the network data that will be rejected to transmitting terminal 1.
Embodiment five:
The structural representation of the processing unit of the another kind of network data that Fig. 8 provides for the embodiment of the present application.
With reference to shown in Fig. 8, the embodiment of the present application, on the basis of the processing unit of the network data described in embodiment four, is also provided with in receiving terminal 2:
Be connected with extraction unit 21, for preserving the memory 25 from the network data of transmitting terminal 1.
In the embodiment of the present application, receiving terminal 2 also comprises memory 25, first the network data that transmitting terminal 1 issues receiving terminal 2 is kept in memory 25, memory 25 herein can realize the function of buffers network data transmission, to the smoothing process of the transmission of network data, to avoid occurring excessive shake, the network bandwidth can be utilized to greatest extent simultaneously, avoid the phenomenons such as the waste of data resource and occur.
Be connected with memory 25 with extraction unit 21 respectively, for preserving the first buffer 26 of the length information of network data, routing iinformation, temporal information, sequence identifier and data message in memory 25 that extraction unit 21 extracts.
When receiving terminal 2 is provided with memory 25, first buffer 26 can be used for preserving the length information in the network data of reception extracted from memory 25, routing iinformation, temporal information, the information of sequence identifier and data message or other type, the follow-up process for network data only needs to extract corresponding information from the first buffer 26, here the first buffer 26 can realize the function of buffers network data transmission equally, to the smoothing process of the transmission of network data, to avoid occurring excessive shake, the network bandwidth can be utilized to greatest extent simultaneously, avoid the phenomenons such as the waste of data resource to occur.
It should be noted that, the first buffer 26 herein can be buffer group, the buffer of multiple par can be set in group, " first " is herein just for the ease of distinguishing the respective function of buffer, and be not used in any restriction is done to the quantity of buffer, in actual applications, buffer here can select First Input First Output buffer FIFO, also can adopt the memory of other types.
In addition, here, the length information of network data, routing iinformation, temporal information, sequence identifier and data message, one group of information of consolidated network data can be thought, characterize this network data simultaneously, and the information being all one group can be kept in same buffer in units of group, also can be kept at correspondingly respectively in the different buffers of the first buffer group, not repeat them here.
Be connected with the first buffer 26 with extraction unit 21 respectively, for preserving the second buffer 27 of the identification information of the network data in the first buffer 26 of extraction unit 21 extraction.
When the first buffer 26 is filled with, the new data from the follow-up transmission of transmitting terminal 1 cannot be received again, so need to empty the first buffer 26, follow-up data could be received, maintenance network is unimpeded, and namely the network data be cleared in the first buffer 26 is considered to the network data given up, needs before emptying, their identification information to be extracted and be separately further processed stored in the second buffer 27.
It should be noted that, the first buffer 26 herein and the second buffer 27 can be independent buffer, also can be buffer group, the buffer of multiple par often can be set among group, " first " and " second " is herein just for the ease of distinguishing the respective function of buffer, and be not used in any restriction is done to the quantity of buffer, in actual applications, here all buffers can select First Input First Output buffer FIFO, also can adopt the memory of other types.
In addition, here, identification information can be a kind of, the sequence identifier of such as network data or temporal information, also can be two or more, the sequence identifier of such as network data and temporal information, when identification information is two or more, two or more can thinking here are one group, the identification information being all one group characterizes a network data simultaneously, and the identification information being all a group can be kept in the different buffers in the second buffer group, one_to_one corresponding is considered as an identification information jointly, also can be kept in units of group in identical buffer, be considered as an identification information.
For judging whether the first buffer 26 has been filled with and has judged whether the quantity of the identification information preserved in the second buffer 27 is less than default threshold value and judges whether transmitting terminal 1 terminates send and judge whether the network data in the first buffer 26 belongs to the judging unit 24 of control command.
In the embodiment of the present application, when the first buffer 26 is filled with, namely think that the transfer of data in network exists obstruction, now need the identification information of the network data that need give up to extract stored in the second buffer 27, therefore need judging unit 24 whether to be filled with the first buffer 26 and judge.
In the embodiment of the present application, when the quantity of the identification information preserved in the second buffer 27 is not less than default threshold value, need to feed back to transmitting terminal 1, therefore need the quantity of judging unit 24 to the identification information preserved in the second buffer 27 whether to be less than default threshold value and judge.
In the embodiment of the present application, when transmitting terminal 1 terminates to send, the identification information of the network data be rejected of preserving in the total quantity of the network data be rejected counting unit 22 counted and current second buffer 27 is needed to send back to transmitting terminal 1, and transmitting terminal 1 do not stop send time, need the data continuing wait-receiving mode transmitting terminal 1, therefore need judging unit 24 pairs of transmitting terminals 1 whether to terminate transmission and judge.
In the embodiment of the present application, the network data that receiving terminal 2 receives may comprise the data control command of receiving terminal 2 and needs being supplied to other equipment by receiving terminal 2, dissimilar network data in first buffer 26 is needed to carry out different process, such as, for control command, can these data of extracting directly, control command is resolved, requirement according to control command performs control action, and for needing the network data being sent to other equipment or port, the every terms of information of the network data in the first buffer 26 can be extracted, according to the requirement structure bag again of network frame, according to the routing iinformation in network data, these data are sent to the equipment or port of specifying, therefore, need judging unit 24 whether to belong to control command to the network data in the first buffer 26 to judge.
Embodiment six:
The structural representation of the processing unit of another network data that Fig. 9 provides for the embodiment of the present application.
With reference to shown in Fig. 9, based on embodiment four or embodiment five, in the embodiment of the present application, the processing unit of network data can also comprise in the receiving terminal:
Be connected with the first buffer 26, for resolving the resolution unit 28 of the network data belonging to control command in the first buffer 26 action according to the requirement of analysis result execution control command.
The network data that receiving terminal 2 receives may comprise the data control command of receiving terminal 2 and needs being supplied to other equipment by receiving terminal 2, therefore, when network data buffers into after in the first buffer 26, receiving terminal 2 needs judgement to be which kind of data, to be for further processing.
If through judging that certain data in confirmation first buffer 26 are control command, then can these data of extracting directly, control command is resolved, according to the requirement execution control action of control command.
Be connected with the first buffer 26, for preserving the network data that do not belong to control command in the first buffer 26 and doing the transmit buffer 29 of process further.
If through judging that certain data in confirmation first buffer 26 are not control commands, then can think that this network data needs to be sent to other equipment or port, then can extract the every terms of information of the network data in the first buffer 26, according to the requirement structure bag again of network frame, according to the routing iinformation in network data, these data are sent to the equipment or port of specifying.
Be more than the core concept of the application, below in conjunction with the adaptable embodiment of the application, description detailed, concrete further and explanation carried out to the thought of the application and scheme.
The schematic flow sheet of the embodiment of the processing method of a kind of network data that Figure 10 provides for the embodiment of the present application.
With reference to shown in Figure 10, the invention provides a kind of method for controlling network data flow that can overcome the above problems, comprise the steps:
Step 401, network data receiving terminal receives the data message of transmitting terminal, and buffer memory is to RAM(memory) in.Specific implementation is as follows:
The memory capacity of RAM, the form of RAM, such as adopt two-port RAM etc., can set according to the requirement of hardware resource, system.The mode of data buffer storage, such as adopts Double buffer etc., can set according to the ability of system data process.
Step 402, network data receiving terminal unpacks data message, extracts length information, routing iinformation, temporal information, sequence number, the data message of bag, deposits respectively in the FIFO of correspondence.Concrete methods of realizing is as follows:
The ethernet frame structure of a standard is by guiding frame head, frame beginning flag, data and frame end mark composition, by unpacking data message, data message, temporal information, sequence number (message identifier) can be extracted, and count the length information of packet, the routing iinformation (flowing to from originating to) of this message should be retrieved from allocation list simultaneously.Subsequently, the length information of this packet, routing iinformation, temporal information, sequence number, data message are deposited in the FIFO of correspondence.In above-mentioned FIFO, storage depth should be consistent, and even the FIFO of memory length is filled with, and remaining FIFO should also expire, even if less than also continuing poke.
Step 403, whether the FIFO described in network data receiving terminal determining step 402 is filled with, if be filled with, carry out step 405, less than then carry out step 404.Concrete methods of realizing is as follows:
If the FIFO described in step 402 has one to be filled with, a full flag bit should be provided, and setting up procedure 405; If be not filled with, then poke can be continued, setting up procedure 404.
Step 404, data message, temporal information, sequence number in the FIFO described in network data receiving terminal extraction step 402, again structure bag, and be stored in transmission buffer memory, do further process.Concrete methods of realizing is as follows:
If the data message that receiving terminal receives needs to be sent to other ports, then can data message, temporal information, sequence number in the FIFO described in extraction step 402, according to the requirement structure bag again of network frame, then according to routing iinformation, be sent to the device port of specifying.If the data message that receiving terminal receives is control word, then can information in the FIFO of the storage data described in extracting directly step 402, command word is resolved, takes next step action according to the requirement of command word.
Step 405, the data message of the message extracted in step 402, length information, routing iinformation are given up by network data receiving terminal, by temporal information, sequence number stored in two new FIFO.Concrete methods of realizing is as follows:
Because now receiving terminal data-handling capacity is saturated, the data message of message, length information, routing iinformation now should be given up, and temporal information, the sequence number of only this message uniqueness of storaging mark, give over to the feedback information of transmitting terminal.
Step 406, network data receiving terminal, to the message doing special processing needing to carry out as described in step 405, carries out counting statistics, counter cumulative 1.
Step 407, sets a threshold value, and whether the amount stored for the FIFO described in determining step 405 reaches the degree can packed and send.If the value of counter equals threshold value, then setting up procedure 408, otherwise setting up procedure 409.Concrete methods of realizing is as follows:
The threshold value of setting should be relevant with the degree of depth of FIFO described in the data payload maximum of network message, step 405.If the value that the counter described in step 406 adds up equals threshold value, then setting up procedure 408, otherwise setting up procedure 409.
Step 408, the temporal information, the sequence number that store in FIFO described in network data receiving terminal extraction step 405, pack, and according to the requirement structure bag again of network frame, message is returned to transmitting terminal, simultaneously by the counter O reset described in step 406, and carry, preserve carry value.
Step 409, network data receiving terminal judges whether the transmission of transmitting terminal terminates, if terminate, setting up procedure 410, otherwise setting up procedure 411.Concrete methods of realizing is as follows:
Whether transmitting terminal sends end, should be judged by transmitting terminal, terminates, should send command word setting up procedure 410 if send, otherwise setting up procedure 411.
Step 410, the numerical value of network data receiving terminal to the counter accumulation described in step 406 is added up, and the packing of this numerical value is returned to transmitting terminal, and waits for that transmitting terminal sends data.Concrete methods of realizing is as follows:
The counter carry value of the storage described in statistic procedure 408, counter current value again described in integrating step 406, calculate receiving terminal altogether to how many messages to carry out doing special processing as described in step 405, namely give up the data message of message, length information, routing iinformation, and only this message time information, sequence number are fed back to transmitting terminal.To the requirement again structure bag of the total value counted according to network frame, and return to transmitting terminal.
Step 411, network data receiving terminal waits for that transmitting terminal sends data.
In sum, the technical scheme provided from above the application, compared with prior art, the technical scheme that the embodiment of the present application provides has following beneficial effect:
1, by the technical scheme that application the application provides, when transmitting terminal occurs that the outburst of paroxysmal network data causes the transfer of data in network to occur to block, receiving terminal can by the reception in buffer but untreated network data give up, clean out buffer space to receive follow-up data, real-time statistics can be carried out to the data be rejected simultaneously, the identification information of the data be rejected of extraction and the total quantity of the data be rejected of calculating are fed back to transmitting terminal and does further process, avoid maintenance and research staff there is misoperation because not knowing which data to be dropped at receiving terminal.
2, the application Technical Design of providing multiple buffer or memory, can receive to greatest extent from transmitting terminal data and shift the data that need give up in time, receiving terminal is when feeding back to transmitting terminal the data be rejected simultaneously, the data bandwidth maximum of load or the buffer depth situation of receiving terminal the max-thresholds of the data volume that once feedback can send can be preset according to network, this makes it possible to utilize the network bandwidth to greatest extent, avoid the waste of resource.
Above the processing method of a kind of network data that the application provides and device are described in detail, apply specific case herein to set forth the principle of the application and execution mode, the explanation of above embodiment is just for helping method and the core concept thereof of understanding the application; Meanwhile, for one of ordinary skill in the art, according to the thought of the application, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application.
In this specification, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually see.
It should be noted that, in this article, such as " be greater than " or " exceeding " or " higher than " or " being less than " or " lower than " etc. and so on relationship description, all can be understood as " be greater than and be not equal to " or " be less than and be not equal to ", also can be understood as " being more than or equal to " or " being less than or equal to ", and not necessarily require or imply that be necessary for restriction or intrinsic a kind of situation.
In addition, in this article, the such as relational terms of " first " and " second " etc. and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, in this article, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.