Embodiment
Essential idea of the present invention, be when server end is in busy condition, can bring in by the client who is connected to this server end and realize the data forwarding function, automatically adjust output policy, reduce the treating capacity of server end, to satisfy the demand of timely acquired information data, improve data transmission efficiency.
Referring to shown in Figure 1, be the schematic flow sheet of data transmission method embodiment of the present invention, it comprises step:
Step S101: server end receives the first request of data information of client, enters step S102;
Step S102: server end judges oneself state judge whether oneself is in idle condition, if not, then enter step S103;
Step S103: from each client that is connected to this server end, select an idle client the most idle, and address information that should the free time client sends to requesting client, enter step S104;
Step S104: the requesting client termination is received the address information of this free time client, and sends the second request of data information to this free time client, enters step S105;
Step S105: idle client receives this second request of data information, will send to requesting client from the information data that server end receives.
According to the present invention program, server end can be adjusted transmission policy automatically according to self free time and busy condition, is unlikely to make the treating capacity of server end much, guarantees normally carrying out of transfer of data work.
At the method for the invention described above, below be elaborated at several concrete implementations wherein.
Embodiment one:
In the present embodiment, suppose to have two clients to be designated as first customer end A, second customer end B respectively to server end S solicited message data, the data transmission procedure between they and the server end S can be:
First customer end A sends request of data information to server end S, request acquired information data, and server end S gives first customer end A with corresponding information data transmission;
Second customer end B sends request of data information to server end S, and request acquired information data after server end receives this request of data information, are judged own current running status:
If be in idle condition, then server end S gives second customer end B with corresponding information data transmission, is example with the vision signal of transmitting camera collection, and its transmission state as shown in Figure 2;
If be in busy condition, then server end S sends to second customer end B with the address information of first customer end A;
After second customer end B receives the address information of first customer end A, send request of data information to this first customer end A, after first customer end A receives this request of data information, the information data that the server end S that receives is transmitted sends to second customer end B, under the application state of real-time acquired information data, first customer end A to the second customer end B information transmitted data can only be receiving the request of data information of second customer end B after, the information data that transmits by server end, vision signal with the transmission camera collection is an example, and its transmission state as shown in Figure 3.
Wherein, server end can be judged by following manner when judging the running status of oneself:
Utilize the running status value of following formula calculation server end:
In the formula, V represents the running status value, it is the quantized value of operation conditions, bandwidth represents the occupancy ratio of acceptable delay time (the current network delay time with) of the network bandwidth, and delay represents the network delay rate, and CPU represents CPU usage, memory represents memory usage, w1, w2, w3, w4 represent bandwidth, delay, CPU, the memory anharmonic ratio that accounts for to the influence of operation conditions respectively, and expression is to the effect value of operation conditions, and be worth big more explanation influences also big more;
When V was greater than or equal to the preset reference value of this server end, the determining server end was in busy condition, and during less than described preset reference value, the determining server end is in idle condition, and the V value is more little idle more at V.
Embodiment two:
In the present embodiment, there to be three clients initiatively to describe to server end S solicited message data and by client to the operation conditions of server end report oneself, these three clients are designated as first customer end A, second customer end B, the 3rd client C respectively, and the data transmission procedure between they and the server end S can be:
First customer end A sends request of data information to server end S, request acquired information data, server end S gives first customer end A with corresponding information data transmission, first customer end A sends to server end with the state information of oneself, reporting the operation conditions of oneself, and can regularly upgrade;
Second customer end B sends request of data information to server end S, and request acquired information data after server end receives this request of data information, are judged own current running status:
If be in idle condition, then server end S gives second customer end B with corresponding information data transmission;
If be in busy condition, then server end S sends to second customer end B with the address information of first customer end A, after second customer end B receives the address information of first customer end A, send request of data information to first customer end A, after first customer end A receives this request of data information, the information data that the server end S that receives is transmitted sends to second customer end B, under the application state of real-time acquired information data, first customer end A to the data of second customer end B transmission can only be receiving the request of data information of second customer end B after, the information data that transmits by server end, second customer end B sends to server end with the state information of oneself, reporting the operation conditions of oneself, and can regularly upgrade;
The 3rd client C sends request of data information to server end S, and request acquired information data after server end receives this request of data information, are judged own current running status:
If be in idle condition, then server end S gives the 3rd client C with corresponding information data transmission;
If be in busy condition, then server end S is according to first customer end A, the running status of second customer end B, therefrom select the most idle idle client, be assumed to be second customer end B, then server end S sends to the 3rd client C with the address information of this second customer end B, after the 3rd client C receives the address information of second customer end B, send request of data information to this second customer end B, after second customer end B receives this request of data information, the information data that is forwarded by the first client S that receives is sent to the 3rd client C, under the application state of real-time acquired information data, second customer end B to the 3rd client C information transmitted data can only be receiving the request of data information of the 3rd client C after, the information data that transmits by first customer end A.
Wherein, server end judge oneself running status mode can with the foregoing description one in identical.
In addition, when judging the running status of each client, identical mode in the time of can adopting with the running status of judging server end, promptly can judge by following manner:
Utilize the running status value of following formula computing client end:
In the formula, V represents the running status value, it is the quantized value of operation conditions, bandwidth represents the occupancy ratio of acceptable delay time (the current network delay time with) of the network bandwidth, and delay represents the network delay rate, and CPU represents CPU usage, memory represents memory usage, w1, w2, w3, w4 represent bandwidth, delay, CPU, the memory anharmonic ratio that accounts for to the influence of operation conditions respectively, and expression is to the effect value of operation conditions, and be worth big more explanation influences also big more;
When V is greater than or equal to the preset reference threshold value of this client, judge that client is in busy condition, during less than this preset reference threshold value, judge that this client is in idle condition, and the V value is more little idle more at V.
Wherein, the preset reference value of server end, the preset reference threshold value of client can be set at identical value, also can set respectively.
After calculating the running status value V of each client, the client that the V value is minimum is defined as idle client, provides the data forwarding service by it.
In addition, the state information that client (for example above-mentioned first customer end A, second customer end B) sends to server end S, it can be himself current operation conditions, include but not limited to the ratio of the shared bandwidth of network traffics, the delay time of packet, the occupation rate of CPU, the occupation rate of internal memory, at this moment, can be after receiving these information by server end S, calculate the running status value of each client more respectively and compare.In addition, it also can be the running status value that calculates oneself by each client respectively, then the running status value that calculates is sent to server end, at this moment, its state information that sends to server end S then is its self running status value of calculating, directly compares after server end S receives to get final product.Mode by server end S unified calculation can realize the synchronization operation, is convenient to unified management, for the needs of administrative convenience, can adopt the mode of server end S unified calculation to carry out usually.
Embodiment three:
Be with the difference of the foregoing description two, in the present embodiment there to be three clients to describe to the state information that server end returns oneself again to client transmit status Query Information, client to server end S solicited message data and server end, these three clients are designated as first customer end A, second customer end B, the 3rd client C respectively, and the data transmission procedure between they and the server end S can be:
First customer end A sends request of data information to server end S, request acquired information data, and server end S gives first customer end A with corresponding information data transmission;
Second customer end B sends request of data information to server end S, and request acquired information data after server end receives this request of data information, are judged own current running status:
If be in idle condition, then server end S gives second customer end B with corresponding information data transmission;
If be in busy condition, then server end S sends to second customer end B with the address information of first customer end A, after second customer end B receives the address information of first customer end A, send request of data information to this first customer end A, after first customer end A receives this request of data information, the information data that the server end S that receives is transmitted sends to second customer end B, under the application state of real-time acquired information data, first customer end A to the second customer end B information transmitted data can only be receiving the request of data information of second customer end B after, the information data that transmits by server end;
The 3rd client C sends request of data information to server end S, and request acquired information data after server end S receives this request of data information, are judged own current running status:
If be in idle condition, then server end S gives the 3rd client C with corresponding information data transmission;
If be in busy condition, then server end S is to first customer end A, the second customer end B transmit status Query Information, after first customer end A, second customer end B receive this status poll information, return the state information of oneself respectively to this server end S, server end S is according to the state information of first customer end A, second customer end B, therefrom select the most idle idle client, be assumed to be second customer end B, then server end S sends to the 3rd client C with the address information of this second customer end B;
After the 3rd client C receives the address information of second customer end B, send request of data information to this second customer end B, after second customer end B receives this request of data information, the information data that is forwarded by the first client S that receives is sent to the 3rd client C, under the application state of real-time acquired information data, second customer end B to the data of the 3rd client C transmission can only be receiving the request of data information of the 3rd client C after, the information data that transmits by first customer end A.
Identical in other technologies feature in the present embodiment and the foregoing description two do not repeat them here.
In the explanation of the various embodiments described above, all be directly to describe from the client that has connected, selecting an idle client the most idle to bring under the situation that is in busy condition at server end S to carry out data forwarding and to be under the idle condition by server end S transmission data at server end S.For consideration to the high efficiency of transmission of data, the running status that also can be comprehensive server end S and each client is determined to bring in the transmission data to initiate client by whom, promptly the running status value of server end S and each client is all carried out the comparison of size, if the running status value minimum of server end S, then directly give these initiate client transmissions data by server end S, if the running status value minimum of certain client, then this client is defined as idle client, and provides the data forwarding service for this initiate client by this free time client.
Embodiment four:
In the present embodiment, with have three clients need to server end S solicited message data, each client initiatively to the own running status of server end report and from server end and client that each has inserted the most idle individuality of selection transmit data and describe, these three clients are designated as first customer end A, second customer end B, the 3rd client C respectively, and the data transmission procedure between they and the server end S can be:
First customer end A sends request of data information to server end S, request acquired information data, server end S gives first customer end A with corresponding information data transmission, first customer end A sends to server end with the state information of oneself, reporting the operation conditions of oneself, and can regularly upgrade;
Second customer end B sends request of data information to server end S, and request acquired information data after server end receives this request of data information, are judged the idle condition of own and first customer end A:
If server end S is than the first customer end A free time, then server end S gives second customer end B with corresponding information data transmission;
If first customer end A is than the server end S free time, then server end S sends to second customer end B with the address information of first customer end A, after second customer end B receives the address information of first customer end A, send request of data information to this first customer end A, after first customer end A receives this request of data information, the information data that the server end S that receives is transmitted sends to second customer end B, under the application state of real-time acquired information data, first customer end A to the data of second customer end B transmission can only be receiving the request of data information of second customer end B after, the information data that transmits by server end S;
Second customer end B sends to server end S with the state information of oneself, reporting the operation conditions of oneself, and can regularly upgrade;
The 3rd client C sends request of data information to server end S, request acquired information data, after server end receives this request of data information, judge oneself, the running status of first customer end A and second customer end B:
If S is the most idle for server end, then server end S gives the 3rd client C with corresponding information data transmission;
If certain client wherein is the most idle, suppose that second customer end B is the most idle, then server end S sends to the 3rd client C with the address information of this second customer end B, after the 3rd client C receives the address information of second customer end B, send request of data information to this second customer end B, after second customer end B receives this request of data information, with the information data that transmits by server end S that receives, perhaps the information data that is forwarded by the first client S sends to the 3rd client C, under the application state of real-time acquired information data, second customer end B to the data of the 3rd client C transmission can only be receiving the request of data information of the 3rd client C after, the information data that transmits by the server end S or first customer end A.
Wherein, server end judge the mode of own running status and judgement client running status, judge whose the most idle other technologies feature such as mode can with the foregoing description three in identical, do not repeat them here.
Embodiment five:
The difference of present embodiment and the foregoing description four is, be to describe in the present embodiment there to be three clients to return the operation conditions of oneself and from server end and client that each has inserted, to select the most idle individuality to transmit data to server end again to client behind the client transmit status Query Information to server end S solicited message data, server end, these three clients are designated as first customer end A, second customer end B, the 3rd client C respectively, and the data transmission procedure between they and the server end S can be:
First customer end A sends request of data information to server end S, request acquired information data, and server end S gives first customer end A with corresponding information data transmission;
Second customer end B sends request of data information to server end S, request acquired information data, after server end receives this request of data information, to the first customer end A transmit status Query Information, after first customer end A receives this status poll information, return oneself state information to server end S, server end S judges the idle condition of own and first customer end A according to the operation conditions of self and the state information of first customer end A:
If server end S is than the first customer end A free time, then server end S gives second customer end B with corresponding information data transmission;
If first customer end A is than the server end S free time, then server end S sends to second customer end B with the address information of first customer end A, after second customer end B receives the address information of first customer end A, send request of data information to this first customer end A, after first customer end A receives this request of data information, the information data that the server end S that receives is transmitted sends to second customer end B, under the application state of real-time acquired information data, first customer end A to the second customer end B information transmitted data can only be receiving the request of data information of second customer end B after, the information data that transmits by server end S;
The 3rd client C sends request of data information to server end S, request acquired information data, after server end receives this request of data information, to first customer end A, the second customer end B transmit status Query Information, after first customer end A, second customer end B receive this status poll information, return the state information of oneself respectively to this server end S, server end S is according to the operation conditions of self and the state information of first customer end A, second customer end B, judge oneself, the running status of first customer end A and second customer end B:
If S is the most idle for server end, then server end S gives the 3rd client C with corresponding information data transmission;
If certain client wherein is the most idle, suppose that second customer end B is the most idle, then server end S sends to the 3rd client C with the address information of this second customer end B, after the 3rd client C receives the address information of second customer end B, send request of data information to this second customer end B, after second customer end B receives this request of data information, with the information data that transmits by server end that receives, perhaps the information data that is forwarded by the first client S sends to the 3rd client C, under the application state of real-time acquired information data, second customer end B to the data of the 3rd client C transmission can only be receiving the request of data information of the 3rd client C after, the information data that transmits by the server end or first customer end A.
Identical in other technologies feature in the present embodiment and the foregoing description four do not repeat them here.
In the explanation of the various embodiments described above to data transmission method of the present invention, only be to be illustrated with the situation that has two clients, three clients, exist under the situation of more number more, according to identical processing mode, server end S can be according to oneself state and the operation conditions that connected and received each client of data, initiate client is carried out resource allocation, so that each initiate client can both be smooth, receive information data efficiently, realize high efficiency transfer of data.
In addition, no matter adopt above-mentioned which kind of transmission policy, in the process of transfer of data, also can be according to the running status of each client and server end S, adjust the data transmission relations between server end S and each client in real time, concrete adjustment mode will not be added narration at this.
According to the data transmission method of the invention described above, the present invention also provides a kind of data transmission system, data transmission system of the present invention, and it comprises server end and plural client, wherein:
This server end, be used to receive the first request of data information of client, judge oneself state, when being in busy condition, from each client that is connected to this server end, select an idle client the most idle, and address information that should the free time client sends to described client;
Client, be used for sending the described first request of data information to server end, receive the address information of described idle client, send the second request of data information, obtain the information data that this free time client receives from server end from described idle client to this free time client.
According to the present invention program, server end can be adjusted transmission policy automatically according to self free time and busy condition, is unlikely to make the treating capacity of server end much, guarantees normally carrying out of transfer of data work.
Referring to shown in Figure 4, be the structural representation of data transmission system embodiment of the present invention, in this example, be to describe to have two clients, described server end specifically comprises:
The server receiving element is used to receive described first request of data that each client sends;
The state judging unit is used to judge oneself state, and when being in busy condition, selects an idle client the most idle from each client that is connected to this server end;
The server transmitting element is used for information data is sent to client, also is used for the address information of described idle client is sent to described client;
Described client specifically comprises:
The client transmitting element, be used for sending the described first request of data information to described server end, send the second request of data information to described idle client, also be used for this client's state information is sent to described server end, the information data that also is used for receiving element is received is transmitted to the client that is connected to this client;
The client receiving element is used to receive the information data that described server end sends, and also is used to receive the address information of the described idle client that described server end sends, and receives the information data that described idle client sends.
In addition, when server end was in idle condition, server end can directly send information data to described client.
Under another performance, can also be the idle condition that can also compare server end and be connected to each client of this server end by server end, when server end is the most idle, information data is sent to the described request client; When the idle client that is connected to this server end is the most idle, the address information of this free time client is sent to described client.
In addition, client can also regularly be reported the state information of self to described server end; Described server end is selected idle client according to each client's state information.Perhaps also can be at server end behind each the client transmit status Query Information that is connected to this server end, each client is returned the state information of oneself again to server end, server end is selected idle client according to each client's state information again.
Wherein, the adjustment mode of the data transmission policies of data transmission system of the present invention and judge that whether idle the specific implementation of the mode or the like of server end and definite idle server can be described with reference to the data transmission method of the invention described above does not repeat them here.
The data transmission system of the invention described above can be applicable to preferably that each client need visit the field of same data content, field of video monitoring for example, and at this moment, data transmission system of the present invention is a video monitoring system.
Above-described embodiment of the present invention only is the detailed description to the specific embodiment of the present invention, does not constitute the qualification to protection range of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within the claim protection range of the present invention.