Summary of the invention
In view of this, main purpose of the present invention is to propose a kind of data transmission method based on P2P, to reduce cost.
Another object of the present invention is to propose a kind of data transmission system based on P2P, to reduce cost.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of data transmission method based on P2P is set up P2P in advance and is connected between transmit leg and recipient, the number of described transmit leg is at least two, and described recipient's number is at least two, and this method also comprises:
A, each transmit leg identify respectively the transmission data that it sent according to the type of transmission data, each transmit leg sign identical wherein to the transmission The data of same type, and each transmit leg connects the transmission data that send described process sign to the recipient based on P2P, and the type of wherein transmitting data is at least a kind of;
B, each recipient resolve its received transmission data obtaining the sign of transmission data, and to identifying identical transmission data according to handling with the unification of sign corresponding type.
Described transmission data be in voice data, video data, e-file, the instant communication information any or wherein more than a kind of combination in any.
The type of described transmission data is at least two kinds, and this method further comprises: before sending the transmission data, transmit leg uniformly-spaced mixes various types of transmission data in advance;
Steps A is described, and connection to the transmission data that the recipient sends through sign is based on P2P: connection sends the transmission data that described quilt uniformly-spaced mixes to the recipient based on P2P.
In described transmission data through uniformly-spaced mixing, M the additional data in every N audio/video data interval, wherein N is the positive integer more than or equal to 1, M is the positive integer more than or equal to 1.
And per three audio/video datas are an additional data at interval.
Described additional data is e-file or instant communication information.
A kind of data transmission system based on P2P, this system comprises transmit leg and recipient, and the number of wherein said transmit leg is at least two, and described recipient's number is at least two:
Each transmit leg, be used for the transmission data that it sent being identified respectively according to the type of transmission data, each transmit leg sign identical wherein to the transmission The data of same type, and each transmit leg connects the transmission data that send described process sign to the recipient based on P2P, and the type of wherein transmitting data is at least a kind of;
Each recipient is used to resolve its received transmission data obtaining the sign of transmission data, and to identifying identical transmission data according to handling with the unification of sign corresponding type;
The P2P that is connected between described transmit leg and the recipient connects.
The type of described transmission data is at least two kinds,
Described transmit leg is further used for, and before sending the transmission data various types of transmission data is uniformly-spaced mixed.
Described transmits data packets through uniformly-spaced mixing is drawn together audio/video data and additional data, and the additional data in per three audio/video datas interval.
From technique scheme as can be seen, in the data transmission method based on P2P of the present invention, transmit leg identifies the transmission data according to the type of transmission data, and connect to the recipient based on P2P and to send transmission data through sign, the recipient resolve the transmission data with obtain the transmission data sign, and according to the sign pairing type to the transmission data handle.This shows, use after the present invention, can save the local dissimilar transmission data that send.In addition, the present invention can also be on the basis of many people of P2P audio frequency and video communication, to existing audio frequency and video passage recycling, realized that many personal data such as the many people text that need not the server distribution is chatted, many people file is shared are shared, and can guarantee the fluency of audio frequency and video communication.
Embodiment
For making the purpose, technical solutions and advantages of the present invention express clearlyer, the present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
Main thought of the present invention is: in the P2P communication pattern, at transmit leg data of different types is identified, the recipient handles different data accordingly according to sign, to realize utilizing same data channel to transmit different types of data, need not to adopt extra server, thereby greatly save cost.
Fig. 1 is the exemplary method flowchart based on P2P transmission data of the present invention.This method is set up P2P in advance and is connected between transmit leg and recipient, as shown in Figure 1, this method also comprises:
Step 101: transmit leg identifies described transmission data according to the type of transmission data, and connects the transmission data that send described process sign to the recipient based on described P2P, and the type of wherein transmitting data is at least a kind of.
For the data channel that only is used to transmit data, in fact and what content what be indifferent to transmission be.Therefore, can identify respectively, and then the uniform data after will identifying transmits by the data channel that P2P connects data of different types.
Step 102: the recipient resolve the transmission data with obtain the transmission data sign, and according to the sign pairing type to the transmission data handle.
After the recipient obtains the transmission data, at first the transmission data are resolved to obtain sign, according to the pairing type of sign the transmission data are handled then.
Because that the transmission data that the recipient receives have is multiple, therefore need difference to handle here.Can at first resolve to obtain sign, according to the pairing type of sign the transmission data be handled then the transmission data.
Such as, the audio frequency and video chat in using with instant messaging below is that the present invention will be described for example.
At first, when many people when carrying out the P2P communication, will between per two people, set up a data channel, to be used to transmit the transmission of data.Such as, when N people carried out many people video, everyone can set up data channel with other N-1 people so, by these passages the audio, video data of oneself is transferred to other N-1 people then, receive audio, video data simultaneously, thereby carry out the audio frequency and video communication from other N-1 people.
Yet, for the audio, video data passage, though be to be used for the transmission tone video data specially, but audio, video data passage and what data what be indifferent to transmission be in fact, utilize this point, can utilize these audio frequency and video passages fully, allow it transmit some additional data, thereby realize extra communication function.According to the present invention, can identify data, thereby be convenient to resolve and handle data of different types.Because the bottom passage is all made no exception for the transmission of any data, so needed data are identified before transmission, the recipient goes out different data according to the data parsing of unified sign then, thereby carries out different processing.Simultaneously because what utilize is the audio frequency and video passages, so to consider influence to the audio frequency and video communication, and not should as passage equally directly carry out the transmission and the reception of data.In order to guarantee the smoothness of audio frequency and video communication, need endlessly data flow and on the audio frequency and video passage, transmit.When using this channel transfer additional data, will drop to influence minimumly so, and make it can not produce excessive influence the fluency of audio frequency and video communication to the audio, video data transmission.
Respectively the transmission means of using transmit leg of the present invention and recipient is described below.
Fig. 2 is the exemplary flow schematic diagram that transmit leg sends data according to the present invention.As shown in Figure 2, this method comprises:
Step 201: data of different types is added corresponding sign respectively, then uniform data is added the data transmit queue;
Transmit leg needed data are identified before transmission, can go out different data according to the data parsing of unified sign thereby receive, to carry out different processing.Here, transmit leg is relevant with functional requirement to the sign of data, because the recipient will do different processing to different performance datas.Such as, video data need be decoded and demonstration, text chat data need show in chat box, image data need be resolved and demonstration etc. with corresponding picture format.Therefore at transmit leg, will add first performance data sign, will add second performance data sign, will add the 3rd performance data sign etc. corresponding to the data of the 3rd function corresponding to the data of second function corresponding to the data of first function.Transmit leg adds the data transmit queue with these uniform datas after the data of difference in functionality (variety classes just) have been added different signs.Here, the transmission data can in voice data, video data, e-file, the instant communication information any or wherein more than a kind of combination in any.
Step 201: from transmit queue, obtain data, and send to different users.
Because preferably corresponding to a plurality of users, that is to say preferably, the load mode of P2P preferably sends data here to different recipients corresponding to a plurality of transmit legs and recipient.In like manner, other transmit leg has identical or similar transmission flow.
When the number of transmit leg is at least two, each transmit leg identifies respectively the transmission data that it sent according to the type of transmission data, wherein each transmit leg sign identical to the transmission The data of same type, and each transmit leg connects the transmission data that send described process sign to the recipient based on P2P.
So just realized the mode of the data of multiple function to a plurality of user's distributions.And, to set up the reception of multichannel data and the mechanism such as dissection process of multiple performance data too for the recipient.Corresponding to flow process shown in Figure 2, Fig. 3 is for the recipient receives the exemplary flow schematic diagram of data according to the present invention.As shown in Figure 3, comprising:
Step 301: receive data, and all data are added the data processing formation from different user;
Because preferably corresponding to a plurality of users, that is to say preferably, the load mode of P2P preferably receives data here from different recipients corresponding to a plurality of transmit legs and recipient, and with all data adding data processing formations.
Step 302: from the data processing formation, obtain and resolution data, handle accordingly corresponding to the data of different identification.
, at first from the data processing formation, obtain data here, then data are resolved being identified accordingly, and divide other processing identifying pairing data.Such as video data being decoded and showing, need show in chat box, image data is resolved with corresponding picture format and demonstration etc. to the text chat data.That is to say, the data of different functions are done different processing.
Wherein, when recipient's number was at least two, each recipient resolved its received transmission data obtaining the sign of transmission data, and to identifying identical transmission data according to handling with the unification of sign corresponding type.
Obviously,,, can finish multi-user's versatile system, such as in the chat of many people audio frequency and video, carrying out the chat of many people text by recycling to many people of P2P audio frequency and video passage according to said method.Fig. 4 is the many people audio frequency and video of the one exemplary embodiment according to the present invention and the schematic diagram of text chat.As seen from Figure 4, a plurality of users can also carry out text chat when carrying out the chat of many people audio frequency and video, thereby have greatly promoted the intimate impression of chat, and do not need existing server architecture is improved, but also have greatly saved cost.
In addition, when applying the present invention to the many people of instant messaging in using and chat,,, preferably directly do not carry out the transmission and the reception of data so need to consider the influence of additional data to the audio frequency and video communication because what utilize is that the audio frequency and video passage transmits additional data.In order to guarantee the smoothness of audio frequency and video communication, needing endlessly data flow transmits on the audio frequency and video passage, therefore when using this channel transfer additional data, will drop to influence minimumly, and make it can not produce any bad influence the fluency of audio frequency and video communication to the audio, video data transmission.The present invention preferably controls the transmission frequency of additional data, avoids audio frequency and video smoothness degree is impacted.
When supplemental transmission data is excessive, not only to carry out the burst transmission to data by adding sign, also to control the frequency of its transmission, otherwise just might cause the obstruction of audio, video data, thereby influence the fluency of audio frequency and video communication owing to a large amount of transmission of additional data.
Therefore, preferably before sending the transmission data, transmit leg uniformly-spaced mixes various types of transmission data in advance in the present invention.Because the existence of data transmit queue, so as long as additional data adding data transmit queue is certain at interval, also be certain by the queue sequence interval that sends of fetching data when then sending, so just can ignore the Network Transmission that the network reason causes and fluctuate.So, for audio, video data, be to add continuously when adding the data transmit queue, and additional data uniformly-spaced insert when adding the data transmit queue, transmitting data like this is exactly uniformly-spaced to mix.Therefore as long as regular obtain data from the transmit queue order and send, just can guarantee that the time interval of data transmission is certain.
Here, described through the transmission data of uniformly-spaced mixing in, can M the additional data in every N audio/video data interval, wherein N is the positive integer more than or equal to 1, M also is the positive integer more than or equal to 1.The present invention is to value and the indefinite of N and M, and the value of N both can also can also equal M less than M greater than M.Such as, when N equals 3, can be per 3 audio/video datas, 1 additional data at interval, also can per 3 audio/video datas 2 additional datas at interval, all right per 3 audio/video datas are 3 additional datas at interval, generally select per three audio, video datas to insert an additional data.
Obviously, though more than to equal 3 with N be that example describes, the present invention there is no any qualification to the value of N.
Fig. 5 is transmit queue schematic diagram according to an embodiment of the invention.Circle shape data are audio, video data among Fig. 5, and block data are additional data, as seen from Figure 5, uniformly-spaced insert 1 additional data every 3 audio, video datas, and wherein additional data can be e-file, instant communication information (text chat information) etc.
Fig. 6 is the demonstrative structure schematic diagram based on P2P transmission data system of the present invention.As shown in Figure 6, this system comprises some terminals, and wherein each terminal both can be transmit leg, can be the recipient again.This system comprises:
Transmit leg is used for according to the type of transmission data described transmission data being identified, and connects the transmission data that send described process sign to the recipient based on P2P, and the type of wherein transmitting data is at least a kind of;
The recipient is used to resolve the transmission data obtaining transmitting the sign of data, and according to the pairing type of sign the transmission data is handled;
The P2P that is connected between described transmit leg and the recipient connects.
Preferably, the number of described transmit leg is at least two, and described recipient's number is at least two,
Each transmit leg, be used for the transmission data that it sent being identified respectively according to the type of transmission data, each transmit leg sign identical to the transmission The data of same type wherein, each transmit leg are further used for connecting to the recipient based on described P2P and send described transmission data through sign;
Each recipient is used to resolve its received transmission data obtaining the sign of transmission data, and to identifying identical transmission data according to handling with the unification of sign corresponding type.
More preferably, the type of described transmission data is at least two kinds, and described transmit leg is further used for, and before sending the transmission data various types of transmission data is uniformly-spaced mixed.Wherein draw together audio/video data and additional data through the transmits data packets of uniformly-spaced mixing, and the additional data in per three audio/video datas interval.
This shows, use after the present invention, can on the basis of many people of P2P audio frequency and video communication, can reuse, thereby realized that many personal data such as the many people text that need not the server distribution is chatted, many people file is shared are shared existing audio frequency and video passage.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.