Summary of the invention
For the defect existed in prior art, the purpose of this invention is to provide a kind of method of communicator and the transmission of multi-protocols multichannel individual-layer data.This device and method can calculate automatically affects the data of communication interaction factor, and forms optimum communication interaction control model and mode, to improve performance and the efficiency of communication server system.
In order to realize the foregoing invention purpose, the technical solution used in the present invention is:
A kind of communicator, comprise strategy controller, channel manager and message access device; The factor of described strategy controller based on affecting the message data transmission forms the mutual control parameter to channel; The mutual selection of control parameter of described channel manager based on strategy controller output be for the communication interaction mode of different communication links, thereby form different communication links; Described message access device, the communication interaction mode provided based on the signal management device, realize connecting and information interaction with Terminal Server Client.
In an optional execution mode, the described factor that affects the message data transmission comprises the type of message and/or the congestion of frequency and/or channel.Perhaps, the frequency that the transmission quantity that the described factor that affects the message data transmission can be message data and/or message data send and/or the number clients of external linkage.
Preferably, the mutual selection of control parameter of described channel manager based on strategy controller output for the communication interaction mode of different communication links is: the data factor that affects the message data transmission is weighted, according to the comprehensive weight value, selects the communication interaction mode.
Further, the account form of described comprehensive weight value is: data frequency * data frequency weighted value+volume of transmitted data * weighted value+client linking number * client connection weight+data security rank * level of security weight=comprehensive weight value.
Described strategy controller is adjusted the control parameter according to the real-time variation of factor that affects the message data transmission, thereby the oneself who has the congestion channel allocates ability.
Further, the communication interaction mode provided for different channels comprises control command agreement and Data Transport Protocol.
The present invention also provides a kind of communication means, comprising: step 1: the factor based on affecting the message data transmission forms the mutual control parameter to channel; Step 2: the mutual selection of control parameter based on strategy controller output is for the communication interaction mode of different communication links; Step 3: based on described communication interaction mode, realize connecting and information interaction with Terminal Server Client.
In a nonrestrictive execution mode, further comprising the steps of before described step 1: as to set up channel interactive mode and definition based on various Different Strategies.
Further, in described step 2, after the communication interaction mode of mutual selection of control parameter for different communication links based on strategy controller output, also comprise: step 2-1: according to different channel interactive modes, producing different is actual channel; Step 2-2: a plurality of channel build are become to a token ring; Step 2-3 selects most suitable channel interactive mode according to the channel token ring.
Alternatively, the communication interaction mode of the selection correspondence in described step 2 is specially: the data factor that affects the message data transmission is weighted, according to the comprehensive weight value, selects communication mode.
Further, the described factor that affects the message data transmission is volume of transmitted data and/or data frequency and/or client linking number and/or data security rank; The account form of described comprehensive weight value is: data frequency * data frequency weighted value+volume of transmitted data * weighted value+client linking number * client connection weight+data security rank * level of security weight=comprehensive weight value.
The communication interaction mode provided for different channels comprises control command agreement and Data Transport Protocol.Preferably, utilize TCP or UDP to carry out control command control, utilize UDP or Transmission Control Protocol to carry out Data Transmission Controlling; Acquiescence adopts TCP to carry out the mutual of control command message and adopts UDP to carry out the mutual of data message.
Effect of the present invention is: utilize technical scheme of the present invention, in conjunction with concrete application (for example, in conjunction with TCP, the characteristic of UDP, then the actual scene of associated upper service application), can dynamically allocate the communication interaction mode of same remote client, thus the efficiency of height-adjusting system effectively.Channel based on different forms token ring at incoming end, and the access client is stopped up and idle channel according to finding very easily by this token ring, thereby the channel based on optimum is set up with the corresponding mutual control model of client.
Embodiment
Below in conjunction with the drawings and specific embodiments, the invention will be further described.
As shown in Figure 1, the first execution mode of the present invention provides a kind of communicator.This communicator comprises: strategy controller, channel manager and message access device.The factor (for example access the type of various message and/or the congestion equivalence of frequency and/or channel) of described strategy controller based on affecting the message data transmission forms the mutual control parameter to channel.Channel manager, the mutual selection of control parameter based on strategy controller output is for the communication interaction mode of different communication links, thereby forms different communication links.The message access device, the communication interaction mode provided based on the signal management device, realize connecting and information interaction with Terminal Server Client.
The purpose of described strategy controller is to realize the policy control of communication link and exchange channels etc., thereby realizes different interacting message control channel patterns by this strategy controller; Described channel manager is realized the management to the message communicating link based on control strategy, the mutual control and management of main order agreement and Data Transport Protocol; The channel that the message access controller provides based on channel manager, realize with the mutual control of Client command and the strategies such as transmission control of data.
Above-mentioned communicator can be used for carrying out following steps:
Step 1: set up channel interactive mode and definition based on various Different Strategies.
Step 2: according to different channel interactive modes, producing different is actual channel, and a plurality of channel build are become to a token ring.
Step 3: access message end is selected most suitable channel interactive mode according to the channel token ring, thereby realizes with the order of client and the mutual control of data message.
One preferred embodiment in, control strategy has real-time, dynamically according to variation, is adjusted in real time; And the oneself that strategy controller has the congestion channel allocates ability.
The described factor that affects the message data transmission comprises the type of message and/or the congestion of frequency and/or channel etc.; In another optional execution mode, the factor that affects the message data transmission can be transmission quantity and/or the frequency of message data transmission and/or the number clients of external linkage of message data.
Communication interaction mode corresponding to described selection is specially: the data factor that affects the message data transmission is weighted, according to the comprehensive weight value, selects communication mode.
Strategy controller output ground is controlled parameter and is comprised volume of transmitted data, data frequency, client linking number, data security rank; The account form of described comprehensive weight value is: data frequency * data frequency weighted value+volume of transmitted data * weighted value+client linking number * client connection weight+data security rank * level of security weight=comprehensive weight value.
The communication interaction mode provided for different channels mainly is divided into two kinds of control command agreement and Data Transport Protocols; Preferably, utilize TCP or UDP to carry out command messages control, utilize UDP or Transmission Control Protocol to carry out data-message and control alternately; Acquiescence adopts TCP to carry out the mutual of control command message and adopts UDP to carry out the mutual of data message.Channel based on different forms token ring at incoming end, and the access client is stopped up and idle channel according to finding easily by this token ring, thereby the channel based on optimum is set up with the corresponding mutual control model of client.
The communication strategy of below describing in detail in above-mentioned execution mode is controlled processing.In the communication interaction channel, the factor that affects the message data transmission comprises many aspects, background service performance and information interaction control quality influence key element is mainly comprised: frequency, the size of volume of transmitted data and the number clients of external linkage that data send.Of the present invention more preferred embodiment in, utilize these factors to change a kind of control strategy into, by the control strategy device, the communication interaction mode of server with Terminal Server Client automatically is set.
Fig. 2 has described a kind of execution mode that the present invention controls about communication strategy, and communication strategy is controlled and comprised the following steps:
At first, set up the collocation strategy rule file, the mode of data interaction communication corresponding under this policing rule is set, this policing rule can be set according to actual conditions, and therefore the non-aim of the present invention of concrete rule place is not limited.
Secondly, message is entered to access, and be written in the data-message queue;
The 3rd, the data factor of data-message queue unit dynamic calculation message access, and the data factor of calculating is pushed to strategy controller; Based on this execution mode another comparatively preferred embodiment in, the quantity that described data factor is the message that receives in the unit interval, and/or average data volume per minute.Described propelling movement can be for being pushed by the message informing event.
The 4th, strategy controller is automatically adjusted the communication interaction mode according to described data factor.In a preferred execution mode, strategy controller is according to described data factor, and and other factor (for example, the level of security of client linking number and client etc.) automatically adjust communication interaction mode (for example, Data Transport Protocol, control command agreement etc.).
Server carries out long-range connection by the communication mode after allocating, and sets up the transmission mechanism of message data.Referring to Fig. 3, when server end carries out data interaction in same client, need to carry out Data Transmission Controlling and control command controls, Data Transmission Controlling mainly is responsible for that backstage is received to message data and is transferred to client by data channel, it is that to carry out various control commands by control command passage and client mutual that control command is controlled, as the security credential of authentication, data, whether arrive the order such as authentication alternately.So the present invention changes above-mentioned data factor (such as data channel, control command passage, control command etc.) and the processing mode under specific factor into a kind of control mode, thereby form strategy controller.In the control law unit, the present invention carrys out the interactive communication mechanism with client according to data factor Dynamic Selection by rule configuration, thereby improves as much as possible the performance of resource utilization and service system.
Further, to communicate mutual mode (interactive communication mechanism) with client can be at least one in following 8 kinds of modes to server.
Communication mode |
Data Transport Protocol |
The control command agreement |
1 |
UDP |
TCP |
2 |
UDP |
UDP |
3 |
TCP |
TCP |
4 |
TCP |
UDP |
5 |
TCP |
Nothing |
6 |
UDP |
Nothing |
7 |
Nothing |
TCP |
8 |
Nothing |
UDP |
In a nonrestrictive execution mode, the strategy controller in above-mentioned the second execution mode can be quantity and/or the number of connection of the quantity of message and/or the message that receives in the unit interval according to described policing rule and described data factor; Described other factor can be that the safe level of client linking number and client is not moved.Communicate mutual mode in conjunction with above-mentioned server with client, can carry out following selection:
Data volume |
Data frequency |
Number of connection |
Level of security |
Communication mode |
Many |
With |
Many |
With |
1 |
Many |
With |
Few |
With |
1 |
Many |
With |
Many |
Low |
6 |
... |
... |
... |
... |
... |
For example, when the message number received is more, data volume (data frequency) average per minute is higher, number of connection is more, when level of security is higher, selects communication mode 1.When the message number received is more, data volume (data frequency) average per minute is higher, number of connection is less, when level of security is higher, selects communication mode 1.When the message number received is more, data volume (data frequency) average per minute is higher, number of connection is more, when level of security is low, selects communication mode 6.
Above-mentioned high and lowly, many, few all can mean by threshold value.For example, when the message number received be greater than threshold value T1 (for example 1000 it will be understood by those of skill in the art that this numerical value is not definitely to determine, but can set according to actual conditions), think that the quantity of message is more.The quantity of the message received within the unit interval be greater than a threshold value T2 (for example 30 it will be understood by those of skill in the art that this numerical value is not definitely to determine, but can set according to actual conditions), can think that data frequency is higher.For example, when number of connection is greater than a threshold value T3 (50 connections, it will be understood by those of skill in the art that this numerical value is not definitely to determine, but can set according to actual conditions), think that number of connection now is more.When level of security be greater than a threshold value T4 (for example 3 grades it will be understood by those of skill in the art that this numerical value is not definitely to determine, but can set according to actual conditions), think that level of security is higher.
In a better execution mode, in order dynamically to communicate mutual mode, control, used data factor and other factors have been applied to the method for respective weights value in the different range space, adjust communication mode according to the comprehensive weight value, thereby can communicate more neatly mutual control, thereby realize the dynamic management of server with the communication interaction mode of client.In a nonrestrictive example, data frequency weight corresponding relation is as follows:
Data frequency |
The respective weights value |
=<10/second |
0.1 |
>10/second and<50/second |
0.5 |
>=50/second and<100/second |
0.8 |
>100/second |
1 |
Accordingly, can and set out respectively the data volume of reception, data frequency, client linking number and data security rank are equal to the corresponding relation of weighted value, the weight ratio of current strategies in then calculating:
Data frequency * data frequency weighted value+data volume * weighted value+client connects numerical value * client connection weight+data security class value * level of security weight=total weighted value.
In the middle of the application, the data factor can be not limited to data frequency, data volume, number of connection, level of security etc. more widely.In order to tackle different service application scenes, can externally be processed as required the parameter setting of rule and weight, thereby allow system there is certain flexibility.
The present invention also provides a kind of multi-protocols multichannel method for transmitting layered data simultaneously, comprises the following steps: step 1, and monitor local port, and set up the connection with client, receive the message of client; Step 2, in message queue, and automatically calculate the data factor that affects communication interaction by message deposit; Step 3, the result of calculating according to the message queue module are selected corresponding communication interaction mode, and the communication interaction of setting up same client by new communication interaction mode connects.
The described factor that affects the message data transmission comprises transmission quantity and/or the frequency of message data transmission and/or the number clients of external linkage of message data.
The communication interaction mode of the selection correspondence in described step 3 is specially: the data factor that affects the message data transmission is weighted, according to the comprehensive weight value, selects communication mode.
In an optional execution mode, the content of described communication interaction mode comprises Data Transport Protocol and/or control command agreement, described Data Transmission Controlling agreement is responsible for that backstage is received to message data and is transferred to client by data channel, and it is mutual that described control command control protocol is responsible for carrying out control command by control command passage and client.
In preferred execution mode, described data factor is volume of transmitted data, data frequency, client linking number, data security rank; The account form of described comprehensive weight value is: data frequency * data frequency weighted value+volume of transmitted data * weighted value+client linking number * client connection weight+data security rank * level of security weight=comprehensive weight value.
Than prior art, the present invention can play following positive technique effect: at first, technical scheme of the present invention can according to business need to dynamically allocate the communication interaction mode, can effectively utilize the strong point of different agreement.Secondly, the different influencing factors that affects service system is carried out to different weights and process, the needs that can effectively tackle the different business scene.
Method and apparatus of the present invention is not limited to the embodiment described in embodiment, and those skilled in the art's technical scheme according to the present invention draws other execution mode, belongs to equally technological innovation scope of the present invention.