A kind of method of thin-client access standard client and device
Technical field
The present invention relates to technology of Internet of things field, particularly relate to method and the device of a kind of thin-client access standard client.
Background technology
Alljoyn is the framework of point-to-point communication between a kind of equipment based on C/S (Client/Server, client/server) framework.Alljoyn is made up of Bus Daemon (bus finger daemon or bus service) and terminal node.Here terminal node is appreciated that becomes an application program, and application program needs to be registered on Bus Daemon, and Bus Daemon is responsible for the function such as Message routing and service discovery between terminal node.As shown in Figure 1, there are three equipment, equipment 1,2 and 3.Each equipment runs an AlljoynBus Daemon, Bus Daemon on the device 1 connects (or be called register) and two methods program, Bus Daemon on equipment 2 is connected to an application program, and the Bus Daemon of equipment 3 is connected to two methods program.When after device start, the Bus Daemon of 3 equipment will broadcast, and the relevant information of the application program be connected on oneself is broadcasted away.
As a rule, terminal node and Bus Daemon run in the same apparatus.Terminal node can be control end the angle of application program, also can be service end, or supports to control and service simultaneously.Here control end refers to the application component with controlling functions, and service end refers to as control end provides the application component of service.For example, equipment 1 is mobile phone, runs Appx above.Appx is control end, can complete and control TV.Equipment 2 is TV, runs Appz above.Appz is service, and for client provides the interface controlling TV, the service team TV that such client just can call Appz to be provided controls.
The thin-client of Alljoyn refers to, Alljoyn Bus daemon cannot be run due to the restriction (as internal memory restriction, disposal ability restriction etc.) of capacity of equipment, therefore Alljoyn thin-client wants the service or the access Alljoyn network that use Alljoyn, just must be connected on the equipment having Alljoyn Bus daemon (Router).
The standard client of Alljoyn is also referred to as Alljoyn Router.Alljoyn standard client has Alljoyn Bus daemon function, can complete the function such as route, service discovery.Simultaneously Alljoyn standard client also can provide the service of connection for Alljoyn thin-client.
For example, the bulb of family due to disposal ability limited, run Alljoyn thin-client program, the intelligent television of family then runs Alljoyn standard client (Alljoyn Router), if bulb will access Alljoyn network, so will be connected in Alljoyn standard client, as the terminal node of on Alljoyn Busdaemon.
Bus Daemon is responsible for the Message routing between terminal node, the functions such as service discovery.Terminal node refers to the application program based on Alljoyn, needs to be connected on Bus Daemon after startup, if terminal node provides service, then registers a service name to Bus Daemon, is broadcasted away by Bus Daemon.If as control end, so can search service by service name, and complete appointed function by far call.
Alljoyn point-to-point communication has been come by far call (RPC), and the initiator therefore communicated needs the service and the interface that obtain recipient in advance, then produces agent object thus completes far call.The initiator of communication can obtain service and the interface of recipient by inquiry service.
Alljoyn thin-client uses TCP to be connected to the Bus Daemon of Alljoyn standard client, accesses bus network by the Bus Daemon of standard client devices.
Thin-client finds the Bus Daemon name (BusDaemon name adopts the form of domain name reversion, as org.haier.busnode) of the standard client that can connect in a network.When thin-client is found, the Bus Daemon (as org.haier.busnode.gateway.device001) meeting semi-match can return to thin-client information such as the address of oneself and interfaces.Thin-client is just connected on this BusDaemon by TCP.
Concrete steps are as follows:
Step 1: the Bus daemon title of standard client broadcast oneself, thin-client finds the Bus daemon of target in a network, just can connect this Bus daemon after finding.Bus daemon title shape is as org.alljoyn.BusNode.Can adopt prefix matching during searching, namely searching org.alljoyn.BusNode can mate org.alljoyn.BusNode.gateway, also can mate org.alljoyn.BusNode.phone.
Step 2: if there is multiple Bus daemon to meet the searching condition of thin-client in network simultaneously, then thin-client connects on a Bus daemon finding at first.
Step 3: the Bus daemon of thin-client and standard client carries out authentication.
Step 4: after authentication is passed through, then represent successful connection.
In existing Alljoyn technology, the Bus Daemon of thin-client connection standard client has certain randomness.After the standard client devices connected at first goes offline, thin-client correspondingly loses connection, then need again to find the standard client that can connect.If the standard client devices connected frequently goes offline, then the network configuration of thin-client needs correspondingly constantly to adjust, and waste connection resource, affects interaction effect.
Summary of the invention
The technical problem to be solved in the present invention is to provide method and the device of a kind of thin-client access standard client, in order to solve the problem of prior art thin-client by standard client interconnection network instability.
For solving the problems of the technologies described above, on the one hand, the invention provides the method for a kind of thin-client access standard client, comprising:
During thin-client connection standard client, at least select two standard client as connecting object;
Described thin-client selects a standard client as main connection in described connecting object, and connects; And from described connecting object, in remaining standard client, at least select part as alternative connection;
Described thin-client with as after the main standard client connection failure be connected, select the standard client of an alternative connection to connect.
Further, described thin-client with as after the main standard client connection failure be connected, select the standard client of an alternative connection to connect, and connection type be designated main connection.
Further, after described alternative connection is revised as main connection, when there is no the standard client of alternative connection in described connecting object, select new standard client as the standard client of alternative connection.
Described thin-client connects with as the main standard client be connected, and specifically comprises:
Described thin-client sends connection request to the standard client as main connection, and wherein identifying this connection in this connection request is main connection;
Described thin-client sends authentication request to the standard client as main connection, completes and the connection as the main standard client be connected after authentication; Wherein, described authentication request sends to the standard client as main connection before needing the authentication timer arrival arranged in the standard client as main connection.
Further, described thin-client at least selects part as alternative connection from described connecting object in remaining standard client, specifically comprise:
Described thin-client sends connection request respectively to the standard client as alternative connection, and wherein identifying this connection in this connection request is alternative connection; After receiving described connection request as the standard client of alternative connection, judge that connection type is alternative connection, the standard client so as alternative connection removes authentication timer, and preserves the information of described thin-client.
Further, during thin-client connection standard client, standard client all in network sends broadcast request, and receives the response message of each standard client feedback; Wherein, response message at least comprises in following information:
1), the thin-client quantity of the current connection of this standard client;
2), the power supply type of this standard client employing;
3) dump energy when, this standard client adopts portable power source to power.
Further, when the standard client quantity that power supply type in network is fixed power source is more than or equal to two, at least two power supply types are selected to be that the standard client of fixed power source is as connecting object.
Further, select power supply type be the standard client of fixed power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
Further, when only having a power supply type to be the standard client of fixed power source in network, select this standard client as connecting object; Meanwhile, a power supply type is selected to be that the standard client of portable power source is as connecting object at least again.
Further, when the standard client power supply type in network is all portable power source, at least two power supply types are selected to be that the standard client of portable power source is as connecting object.
Further, select power supply type be the standard client of portable power source as connecting object time, according to the main connection of electricity selective sequential from high to low and alternative connection.
Further, select power supply type be the standard client of portable power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
On the other hand, the present invention also provides a kind of thin-client to access the device of standard client, comprising:
Select module, for when thin-client connection standard client, at least selection two standard client are as connecting object;
Link block, for selecting a standard client as main connection in described connecting object, and connects; And from described connecting object, in remaining standard client, at least select part as alternative connection; And for when described thin-client is with during as the main standard client connection failure be connected, select the standard client of an alternative connection to connect.
Further, described link block also for:
When described thin-client with as the main standard client connection failure be connected after, select the standard client of an alternative connection to connect, and connection type be designated main connection.
Further, after described alternative connection is revised as main connection, when there is no the standard client of alternative connection in described connecting object, select new standard client as the standard client of alternative connection.
Described link block also for:
Described thin-client sends connection request to the standard client as main connection, and wherein identifying this connection in this connection request is main connection;
Described thin-client sends authentication request to the standard client as main connection, completes and the connection as the main standard client be connected after authentication; Wherein, described authentication request sends to the standard client as main connection before needing the authentication timer arrival arranged in the standard client as main connection.
Further, described link block also for:
Described thin-client sends connection request respectively to the standard client as alternative connection, and wherein identifying this connection in this connection request is alternative connection; After receiving described connection request as the standard client of alternative connection, judge that connection type is alternative connection, the standard client so as alternative connection removes authentication timer, and preserves the information of described thin-client.
Further, described selection module also for:
During thin-client connection standard client, standard client all in network sends broadcast request, and receives the response message of each standard client feedback; Wherein, response message at least comprises in following information:
1), the thin-client quantity of the current connection of this standard client;
2), the power supply type of this standard client employing;
3) dump energy when, this standard client adopts portable power source to power.
Further, described selection module also for:
When the standard client quantity that power supply type in network is fixed power source is more than or equal to two, at least two power supply types are selected to be that the standard client of fixed power source is as connecting object.
Further, described selection module also for:
Select power supply type be the standard client of fixed power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
Further, described selection module also for:
When only having a power supply type to be the standard client of fixed power source in network, select this standard client as connecting object; Meanwhile, a power supply type is selected to be that the standard client of portable power source is as connecting object at least again.
Further, described selection module also for:
When the standard client power supply type in network is all portable power source, at least two power supply types are selected to be that the standard client of portable power source is as connecting object.
Further, described selection module also for:
Select power supply type be the standard client of portable power source as connecting object time, according to the main connection of electricity selective sequential from high to low and alternative connection.
Further, described selection module also for:
Select power supply type be the standard client of portable power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
Beneficial effect of the present invention is as follows:
The present invention passes through selection two standard client as connecting object, one is main connection, one is alternative connection, when with after the main standard client connection failure be connected, the standard client of alternative connection can be connected fast, ensure that thin-client can access network fast, save the time reconnected, improve efficiency.
Accompanying drawing explanation
Fig. 1 is existing Alljoyn configuration diagram;
Fig. 2 is the flow chart of the method for a kind of thin-client access standard client in the embodiment of the present invention;
Fig. 3 is the flow chart of the method for thin-client access standard client in the specific embodiment of the invention;
Fig. 4 is the structural representation of the device of a kind of thin-client access standard client in the embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing and embodiment, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, do not limit the present invention.
As shown in Figure 2, the embodiment of the present invention relates to the method for a kind of thin-client access standard client, comprising:
Step S101, during thin-client connection standard client, at least selects two standard client as connecting object;
In this step, during thin-client connection standard client, standard client all in network sends broadcast request, and receives the response message of each standard client feedback; Wherein, response message at least comprises in following information:
1), the thin-client quantity of the current connection of this standard client;
2), the power supply type of this standard client employing;
3) dump energy when, this standard client adopts portable power source to power.
During concrete selection connecting object, with reference to following principle:
1), when there is the standard client that power supply type is fixed power source in alternative, then the standard client of fixed power source is selected; When there is the standard client of multiple fixed power source, select the standard client connecting thin-client minimum number at that time; Certainly, also can select to connect the maximum standard client of thin-client quantity at that time.This is because the criterion judged is different, for example, thin-client thinks that the standard client accessing quantity many is more stable, therefore selects to connect the maximum standard client of thin-client quantity and connects; Also can consider from the angle of load balancing, what access thin-client minimum number like this is preferred.
2), when need to select power supply type be the standard client of portable power source as connecting object time, the highest standard client of optional m igration power supply dump energy is as connecting object; When there is the identical standard client of multiple portable power source dump energy, the thin-client quantity choice criteria client according to connecting at that time connects;
3) if all identical by the parameter of all standard client selected, then select according to the order preset, such as, receive the order of feedback message, the domain name of standard client put in order or address arrangement order etc.
Step S102, thin-client selects a standard client as main connection in connecting object, and connects; And in connecting object in remaining standard client at least selection portion divide standard client as alternative connection.
Step S103, described thin-client with as after the main standard client connection failure be connected, select the standard client of alternative connection to connect.
In this step, thin-client with as after the main standard client connection failure be connected, select the standard client of alternative connection to connect, and connection type be designated main connection; Then select new standard client as the standard client of alternative connection.Wherein, thin-client with as the main standard client connection failure be connected, refer to that standard client as main connection is due to the reason such as power down, shutdown, cause between connected thin-client with its (standard client) and cannot communicate, and then cause thin-client cannot by standard client interconnection network.
Provide an instantiation below, so that technical scheme of the present invention to be described.As shown in Figure 3, the thin-client step that is connected to network by standard client is as follows:
The thin-client of step 1:Alljoyn sends broadcast request, obtains the AlljoynBus Daemon information in Alljoyn network.
After the Bus Daemon1,2,3 of step 2:Alljoyn standard client receives, return respective response message respectively, wherein except comprising required content that Alljoyn agreement specifies, also extend following information:
1, thin-client load number: represent and this Bus Daemon is connected to how many thin-clients at present;
2, power supply type: represent that this Bus Daemon is powered by portable power source, or fixed power source is powered;
3, electricity: during this Bus Daemon employing portable power source, the dump energy of portable power source is how many.
Above parameter is used for thin-client and selects to use during Bus Daemon.
Step 3: thin-client receive Bus Daemon1,2, after the response message of 3, select two Bus daemon to be connecting object according to thin-client load number, power supply type and dump energy.Here do not do mandatory requirement to system of selection, it is as follows that the technical program enumerates a kind of selection mode:
First the standard client of fixed power source is selected; If standard client all uses fixed power source, so how much select according to standard client load number, two standard client selecting load number minimum are connecting object.
If standard client adopts portable power source, then two standard client that optional m igration power supply dump energy is the highest.If portable power source dump energy is identical, so how much select according to load number, two standard client selecting load number minimum are connecting object.
If in standard client to be selected, only have the standard client of a fixed power source, then select it to be connecting object; And in the standard client of portable power source, the highest standard client of optional m igration power supply dump energy is as connecting object; If portable power source dump energy is identical, so how much select according to load number, the standard client selecting load number minimum is connecting object.
If all parameters of standard client to be selected are the same, then select according to the rule preset, such as, the order receiving response message according to thin-client is selected.
Step 4: thin-client, according to selective rule, have selected Bus Daemon2 and Bus Daemon3 as connecting object; Wherein, Bus Daemon2 is main connection, and Bus Daemon3 is as alternative connection.
Step 5: thin-client sends connection request to Bus Daemon2, and wherein identifying this connection is main connection.
After step 6:Bus Daemon2 receives this request, reading connection type is main connection, (for representing, authentication timer waits for that thin-client sends the maximum duration of authentication request then to arrange authentication timer, if in this time, thin-client does not send authentication request, so no longer will receive the authentication request of this thin-client, thin-client needs to resend connection request).
Step 7: thin-client sends authentication request to Bus Daemon2, completes the connection with BusDaemon2 after authentication.
Step 8: thin-client sends connection request to Bus Daemon3, and wherein identifying this connection is alternative connection.
Step 9: after Bus Daemon3 receives this request, judge that connection type is alternative connection, so this Bus Daemon3 removes authentication timer, and preserves the relevant information of current thin-client.
Step 10: when after thin-client and Bus daemon2 communication terminal, such as Bus daemon2 goes offline (as equipment shutdown), and Thin clients will send authentication request to Bus Daemon3.
After step 11:Bus Daemon3 receives this authentication request, after authentication is passed through, revising this connection type is main connection, completes the access of thin-client.
Step 12: thin-client sends connection request to Bus Daemon1, and to identify this connection type be alternative connection.Bus daemon1 performs the step identical with step 8, becomes the alternative connecting object of thin-client.
As shown in Figure 4, the embodiment of the present invention also relates to a kind of device realizing the thin-client access standard client of said method, comprising:
Select module, for when thin-client connection standard client, at least selection two standard client are as connecting object;
Link block, for selecting a standard client as main connection in connecting object, and connects; And from described connecting object, in remaining standard client, at least select part as alternative connection; And for when described thin-client is with during as the main standard client connection failure be connected, select the standard client of an alternative connection to connect.
Link block also for:
When described thin-client with as the main standard client connection failure be connected after, select the standard client of alternative connection to connect, and connection type be designated main connection; After described alternative connection is revised as main connection, when there is no the standard client of alternative connection in described connecting object, select new standard client as the standard client of alternative connection.
Described thin-client sends connection request to the standard client as main connection, and wherein identifying this connection in this connection request is main connection;
Described thin-client sends authentication request to the standard client as main connection, completes and the connection as the main standard client be connected after authentication; Wherein, described authentication request sends to the standard client as main connection before needing the authentication timer arrival arranged in the standard client as main connection.
Described thin-client sends connection request to the standard client as alternative connection, and wherein identifying this connection in this connection request is alternative connection; After receiving described connection request as the standard client of alternative connection, connection breaking type is alternative connection, and the standard client so as alternative connection removes authentication timer, and preserves the information of described thin-client.
Select module also for:
During thin-client connection standard client, standard client all in network sends broadcast request, and receives the response message of each standard client feedback; Wherein, response message at least comprises in following information:
1), the thin-client quantity of the current connection of this standard client;
2), the power supply type of this standard client employing;
3) dump energy when, this standard client adopts portable power source to power.
When the standard client quantity that power supply type in network is fixed power source is more than or equal to two, at least two power supply types are selected to be that the standard client of fixed power source is as connecting object.
Select power supply type be the standard client of fixed power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
When only having a power supply type to be the standard client of fixed power source in network, select this standard client as connecting object; Meanwhile, a power supply type is selected to be that the standard client of portable power source is as connecting object at least again.
When the standard client power supply type in network is all portable power source, at least two power supply types are selected to be that the standard client of portable power source is as connecting object.
Select power supply type be the standard client of portable power source as connecting object time, according to the main connection of electricity selective sequential from high to low and alternative connection.
Select power supply type be the standard client of portable power source as connecting object time, select main connection and alternative connection according to the thin-client quantity of the current connection of standard client.
As can be seen from the above-described embodiment, the present invention passes through selection two standard client as connecting object, one is main connection, one is alternative connection, when with after the main standard client connection failure be connected, the standard client of alternative connection can be connected fast, ensure that thin-client can access network fast, save the time reconnected, improve efficiency.
Although be example object, disclose the preferred embodiments of the present invention, it is also possible for those skilled in the art will recognize various improvement, increase and replacement, and therefore, scope of the present invention should be not limited to above-described embodiment.