A kind of method and device of thin-client access standard client
Technical field
The present invention relates to internet of things field, method more particularly to a kind of thin-client access standard client and
Device.
Background technique
Alljoyn is one kind based on point-to-point between the equipment of C/S (Client/Server, client/server) framework
The frame of communication.Alljoyn is made of Bus Daemon (bus finger daemon or bus service) and terminal node.Here end
End node is understood that, as an application program, application program needs to be registered on Bus Daemon, and Bus Daemon is responsible for
The functions 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 set
It is standby all to run an Alljoyn Bus Daemon, on Bus Daemon on the device 1 connection (or to register) two
A application program, the Bus Daemon in equipment 2 are connected to an application program, are connected to two on the Bus Daemon of equipment 3
A application program.After equipment starting, the Bus Daemon of 3 equipment will will do it broadcast, the application that will be connected on oneself
The relevant information of program is broadcasted.
Usually, terminal node and Bus Daemon are run in the same apparatus.Terminal node is from application program
It can be control terminal from the point of view of in angle, be also possible to server-side, or support to control and service simultaneously.Here control terminal refers to
Application component with control function, and server-side refers to and provides the application component of service for control terminal.Citing comes
It says, equipment 1 is mobile phone, operates above Appx.Appx is control terminal, can complete to control TV.Equipment 2 is electricity
Depending on operating above Appz.Appz is service, provides the interface of control TV for client, such client can be adjusted
It is controlled with the service team TV that Appz is provided.
The thin-client of Alljoyn refers to, due to capacity of equipment limitation (such as memory limitation, processing capacity limitation) and
It is unable to run Alljoyn Bus daemon, therefore Alljoyn thin-client is to using the service or access of Alljoyn
Alljoyn network is just necessarily connected in the equipment that one has 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 functions such as routing, service discovery.Alljoyn standard client also can be simultaneously
Alljoyn thin-client provides the service of connection.
For example, the light bulb of family due to processing capacity it is limited, run Alljoyn thin-client program, and family
Smart television then run Alljoyn standard client (Alljoyn Router), if light bulb will access Alljoyn net
Network, then will be connected in Alljoyn standard client, as a terminal node on Alljoyn Bus daemon.
Bus Daemon is responsible for the routing of the message between terminal node, the functions such as service discovery.Terminal node, which refers to, to be based on
The application program of Alljoyn is required connect to after starting on Bus Daemon, and terminal node is provided that service, then to Bus
Daemon registers a service name, is broadcasted by Bus Daemon.If Service name can be passed through as control terminal
Claim come the service of searching, and completes specified function by far call.
Alljoyn point-to-point communication is by far call (RPC) come what is completed, therefore the initiator communicated needs in advance
Service and the interface of recipient are obtained, generates agent object then to complete far call.The initiator of communication can pass through
Query service obtains service and the interface of recipient.
Alljoyn thin-client passes through standard visitor using the Bus Daemon of TCP connection to Alljoyn standard client
The Bus Daemon of family end equipment accesses bus network.
Thin-client finds Bus Daemon name (Bus Daemon of the standard client that can be connected in a network
Word uses the form of domain name reversion, such as org.haier.busnode).When thin-client is found, meet the matched Bus in part
Daemon (such as org.haier.busnode.gateway.device001) can return to the address of oneself and interface information
Thin-client.Thin-client will pass through in TCP connection to the Bus Daemon.
Specific step is as follows:
Step 1: standard client broadcasts the Bus daemon title of oneself, and thin-client finds target in a network
Bus daemon can connect the Bus daemon after finding.Bus daemon title is shaped like org.alljoyn.BusNode.
Prefix matching can be used when searching, i.e. lookup org.alljoyn.BusNode can be matched
Org.alljoyn.BusNode.gateway can also match org.alljoyn.BusNode.phone.
Step 2: if the searching condition for thering are multiple Bus daemon to meet thin-client simultaneously in network, Thin clients
On the Bus daemon that end connection is found at first.
Step 3: thin-client and the Bus daemon of standard client are authenticated.
Step 4: after the authentication is passed, then it represents that successful connection.
In existing Alljoyn technology, the Bus Daemon that thin-client connects standard client has centainly random
Property.After the standard client devices connected at first go offline, thin-client correspondingly loses connection, then needs to find energy again
The standard client enough connected.If the standard client devices of connection frequently go offline, the network structure of thin-client needs phase
Ground constantly adjustment is answered, connection resource is wasted, influences interaction effect.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of method and devices of thin-client access standard client, use
To solve the problems, such as that prior art thin-client connects unstable networks by standard client.
In order to solve the above technical problems, on the one hand, the present invention provides a kind of method of thin-client access standard client,
Include:
When thin-client connects standard client, at least select two standard clients as connecting object;
The thin-client selects a standard client as main connection in the connecting object, and is attached;
And at least selected section alternately connects from standard client remaining in the connecting object;
The thin-client with as the standard client connection failure of main connection after, select a standard alternatively connected
Client is attached.
Further, the thin-client with as the standard client connection failure of main connection after, select one alternatively connect
The standard client connect is attached, and by connection type identify based on connect.
Further, after it will connect based on the alternative connection modification, do not have alternatively to connect in the connecting object
When standard client, the standard client that selects new standard client alternately to connect.
The thin-client is attached with the standard client as main connection, is specifically included:
The thin-client sends connection request to the standard client as main connection, wherein identifies in the connection request
It is connected based on the connection;
The thin-client sends authentication request to the standard client as main connection, completion and conduct after authentication
The connection of the standard client of main connection;Wherein, the authentication request is needed in the standard client setting as main connection
Authentication timer is sent to the standard client as main connection before reaching.
Further, the thin-client at least selected section conduct from standard client remaining in the connecting object
Alternative connection, specifically includes:
The thin-client sends connection request to the standard client alternately connected respectively, wherein the connection request
Middle mark this be connected as alternatively connecting;After the standard client alternately connected receives the connection request, judge to connect class
Type is alternative connection, then the standard client alternately connected removes authentication timer, and saves the thin-client
Information.
Further, when thin-client connection standard client, into network, all standard clients send broadcast request,
And receive the response message of each standard client feedback;Wherein, response message includes at least one in following information:
1), the thin-client quantity that the standard client currently connects;
2), the power supply type that the standard client uses;
3) remaining capacity when, the standard client is powered using mobile power source.
Further, when power supply type is more than or equal to two for the standard client quantity of fixed power source in network, at least
Selecting two power supply types is the standard client of fixed power source as connecting object.
Further, when selecting power supply type for the standard client of fixed power source as connecting object, according to standard client
Hold the main connection of thin-client quantity selection and alternative connection currently connected.
Further, when only one power supply type is the standard client of fixed power source in network, select the standard objective
Family end is as connecting object;Meanwhile at least one power supply type of reselection is the standard client of mobile power source as connection pair
As.
Further, when all mobile power sources of the standard client power supply type in network, two power supplys are at least selected
Type is the standard client of mobile power source as connecting object.
Further, when selecting power supply type for the standard client of mobile power source as connecting object, according to electricity by height
To the low main connection of sequential selection and alternative connection.
Further, when selecting power supply type for the standard client of mobile power source as connecting object, according to standard client
Hold the main connection of thin-client quantity selection and alternative connection currently connected.
On the other hand, the present invention also provides a kind of devices of thin-client access standard client, comprising:
Selecting module, at least selecting two standard clients as company when thin-client connects standard client
Connect object;
Link block for selecting a standard client as main connection in the connecting object, and is attached;
And at least selected section alternately connects from standard client remaining in the connecting object;And for when described thin
When client is with standard client connection failure as main connection, a standard client alternatively connected is selected to be connected
It connects.
Further, the link block is also used to:
After the thin-client is with as the standard client connection failure of main connection, a mark alternatively connected is selected
Prospect end is attached, and by connection type identify based on connect.
Further, after it will connect based on the alternative connection modification, do not have alternatively to connect in the connecting object
When standard client, the standard client that selects new standard client alternately to connect.
The link block is also used to:
The thin-client sends connection request to the standard client as main connection, wherein identifies in the connection request
It is connected based on the connection;
The thin-client sends authentication request to the standard client as main connection, completion and conduct after authentication
The connection of the standard client of main connection;Wherein, the authentication request is needed in the standard client setting as main connection
Authentication timer is sent to the standard client as main connection before reaching.
Further, the link block is also used to:
The thin-client sends connection request to the standard client alternately connected respectively, wherein the connection request
Middle mark this be connected as alternatively connecting;After the standard client alternately connected receives the connection request, judge to connect class
Type is alternative connection, then the standard client alternately connected removes authentication timer, and saves the thin-client
Information.
Further, the selecting module is also used to:
When thin-client connects standard client, into network, all standard clients send broadcast request, and receive
The response message of each standard client feedback;Wherein, response message includes at least one in following information:
1), the thin-client quantity that the standard client currently connects;
2), the power supply type that the standard client uses;
3) remaining capacity when, the standard client is powered using mobile power source.
Further, the selecting module is also used to:
When power supply type is more than or equal to two for the standard client quantity of fixed power source in network, two are at least selected
Power supply type is the standard client of fixed power source as connecting object.
Further, the selecting module is also used to:
When selecting power supply type for the standard client of fixed power source as connecting object, currently connected according to standard client
The main connection of thin-client quantity selection connect and alternative connection.
Further, the selecting module is also used to:
When in network only one power supply type be fixed power source standard client when, select the standard client as
Connecting object;Meanwhile at least one power supply type of reselection is the standard client of mobile power source as connecting object.
Further, the selecting module is also used to:
When all mobile power sources of the standard client power supply type in network, two power supply types are selected at least to move
The standard client of dynamic power supply is as connecting object.
Further, the selecting module is also used to:
When selecting power supply type for the standard client of mobile power source as connecting object, according to electricity from high to low suitable
The main connection of sequence selection and alternative connection.
Further, the selecting module is also used to:
When selecting power supply type for the standard client of mobile power source as connecting object, currently connected according to standard client
The main connection of thin-client quantity selection connect and alternative connection.
The present invention has the beneficial effect that:
The present invention, which passes through, selects two standard clients as connecting object, connects based on one, and one is alternative connection,
After standard client connection failure with main connection, the standard client alternatively connected can be quickly connected, ensure that thin visitor
Family end can quickly access network, save the time of reconnect, improve efficiency.
Detailed description of the invention
Fig. 1 is existing Alljoyn configuration diagram;
Fig. 2 is a kind of flow chart of the method for 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 a kind of structural schematic diagram of the device of thin-client access standard client in the embodiment of the present invention.
Specific embodiment
Below in conjunction with attached drawing and embodiment, the present invention will be described in further detail.It should be appreciated that described herein
Specific embodiment be only used to explain the present invention, limit the present invention.
As shown in Fig. 2, the present embodiments relate to a kind of methods of thin-client access standard client, comprising:
Step S101 at least selects two standard clients as connecting object when thin-client connects standard client;
In this step, when thin-client connects standard client, into network, all standard clients send broadcast and ask
It asks, and receives the response message of each standard client feedback;Wherein, response message includes at least one in following information:
1), the thin-client quantity that the standard client currently connects;
2), the power supply type that the standard client uses;
3) remaining capacity when, the standard client is powered using mobile power source.
When being specifically chosen connecting object, referring to following principle:
1), when in selecting object there are power supply type be fixed power source standard client, then select the mark of fixed power source
Prospect end;When there are the standard client of multiple fixed power sources, selection connected the standard of thin-client minimum number at that time
Client;It is of course also possible to select to connect the most standard client of thin-client quantity at that time.This is because the criterion of judgement
It is different, for example, thin-client thinks that the standard client more than access quantity is more stable, therefore selects connection Thin clients
Hold the standard client connection that quantity is most;Thin-client quantity can also be accessed in this way from the viewpoint of load balancing
Least is preferred.
2), when needing to select standard client of the power supply type for mobile power source as connecting object, mobile electricity is selected
Remaining capacity highest standard client in source is as connecting object;When there are the identical standard visitors of multiple mobile power source remaining capacities
When the end of family, it is attached according to the thin-client quantity selection criteria client connected at that time;
If 3) parameter of all standard clients, selected is all identical, selected according to preset sequence
It selects, for example, receive the sequence of feedback message, the domain name of standard client puts in order or address arrangement sequence etc..
Step S102, thin-client selects a standard client as main connection in connecting object, and is attached;
And at least selected section standard client alternately connects in remaining standard client in connecting object.
Step S103, the thin-client with as the standard client connection failure of main connection after, select alternative connection
Standard client be attached.
In this step, thin-client with as the standard client connection failure of main connection after, select the mark that alternatively connects
Prospect end is attached, and by connection type identify based on connect;Then new standard client is selected alternately to connect
Standard client.Wherein, thin-client and the standard client connection failure as main connection, refer to the mark as main connection
It causes not leading between thin-client connected to it and its (standard client) due to power down, shutdown etc. in prospect end
Letter, network can not be connected by standard client by turn resulting in thin-client.
A specific example is given below, to illustrate technical solution of the present invention.As shown in figure 3, thin-client passes through mark
The step of prospect end is connected to network is as follows:
The thin-client of step 1:Alljoyn sends broadcast request, to obtain the Alljoyn Bus in Alljoyn network
Daemon information.
After Bus Daemon1,2,3 of step 2:Alljoyn standard client receive, respective response is returned respectively and is disappeared
Breath, wherein also extending following information other than comprising required content as defined in Alljoyn agreement:
1, thin-client loads number: indicating to be connected to how many a thin-clients on the Bus Daemon at present;
2, power supply type: indicate that the Bus Daemon is powered by mobile power source power supply or fixed power source;
3, electricity: when the Bus Daemon uses mobile power source, the remaining capacity of mobile power source is how many.
The above parameter when thin-client selection Bus Daemon for using.
Step 3: after thin-client receives the response message of Bus Daemon1,2,3, number, power supply being loaded according to thin-client
Type and remaining capacity are come to select two Bus daemon be connecting object.Here selection method is not strictly required, this
It is as follows that technical solution enumerates a kind of selection mode:
The standard client of fixed power source is selected first;If standard client all uses fixed power source, according to mark
How much prospect end load number selects, and selecting load least two standard clients of number is connecting object.
If standard client uses mobile power source, highest two standard clients of mobile power source remaining capacity are selected
End.If mobile power source remaining capacity is identical, how much selected according to load number, least two marks of selection load number
Prospect end is connecting object.
If in standard client to be selected, the standard client of only one fixed power source then selects it for connection
Object;And in the standard client of mobile power source, the highest standard client of mobile power source remaining capacity is selected to make
For connecting object;If mobile power source remaining capacity is identical, how much selected according to load number, selection load number is minimum
A standard client be connecting object.
If all parameters of standard client to be selected are the same, selected according to preset rule, for example,
It is selected according to the sequence that thin-client receives response message.
Step 4: thin-client has selected Bus Daemon2 and Bus Daemon3 as connection pair according to selection rule
As;Wherein, it is connected based on Bus Daemon2, and Bus Daemon3 is alternately connected.
Step 5: thin-client sends connection request to Bus Daemon2, connects based on the connection wherein identifying.
After step 6:Bus Daemon2 receives the request, is connected based on reading connection type, then authentication timer is set
(the maximum duration that authentication timer is used to indicate that thin-client is waited to send authentication request, if in the time, thin-client is not
Authentication request is sent, then the authentication request of the thin-client will be received no longer, thin-client, which needs to retransmit connection, is asked
It asks).
Step 7: thin-client sends authentication request to Bus Daemon2, is completed after authentication with Bus Daemon2's
Connection.
Step 8: thin-client sends connection request to Bus Daemon3, is connected as alternatively connecting wherein identifying this.
Step 9: after Bus Daemon3 receives the request, judging connection type for alternative connection, then the Bus
Daemon3 removes authentication timer, and saves the relevant information of current thin-client.
Step 10: when thin-client and after Bus daemon2 communication terminal, such as Bus daemon2 goes offline that (such as equipment is closed
Machine), Thin clients will send authentication request to Bus Daemon3.
After step 11:Bus Daemon3 receives the authentication request, after the authentication is passed, modifies and connects based on the connection type,
Complete the access of thin-client.
Step 12: thin-client sends connection request to Bus Daemon1, and identifying the connection type is alternative connection.
Bus daemon1 executes the step identical as step 8, becomes the alternative connecting object of thin-client.
As shown in figure 4, the embodiment of the present invention further relates to a kind of thin-client access standard client for realizing the above method
Device, comprising:
Selecting module, at least selecting two standard clients as company when thin-client connects standard client
Connect object;
Link block for selecting a standard client as main connection in connecting object, and is attached;And from
At least selected section alternately connects in remaining standard client in the connecting object;And for working as the Thin clients
When end is with standard client connection failure as main connection, a standard client alternatively connected is selected to be attached.
Link block is also used to:
After the thin-client is with as the standard client connection failure of main connection, the standard alternatively connected visitor is selected
Family end is attached, and by connection type identify based on connect;After being connected based on modifying the alternative connection, the company
The standard client for when not having the standard client alternatively connected, new standard client being selected alternately to connect is connect in object
End.
The thin-client sends connection request to the standard client as main connection, wherein identifies in the connection request
It is connected based on the connection;
The thin-client sends authentication request to the standard client as main connection, completion and conduct after authentication
The connection of the standard client of main connection;Wherein, the authentication request is needed in the standard client setting as main connection
Authentication timer is sent to the standard client as main connection before reaching.
The thin-client sends connection request to the standard client alternately connected, and wherein the connection request is got the bid
Know this to be connected as alternatively connecting;After the standard client alternately connected receives the connection request, connection breaking type is standby
Choosing connection then the standard client alternately connected removes authentication timer, and saves the information of the thin-client.
Selecting module is also used to:
When thin-client connects standard client, into network, all standard clients send broadcast request, and receive
The response message of each standard client feedback;Wherein, response message includes at least one in following information:
1), the thin-client quantity that the standard client currently connects;
2), the power supply type that the standard client uses;
3) remaining capacity when, the standard client is powered using mobile power source.
When power supply type is more than or equal to two for the standard client quantity of fixed power source in network, two are at least selected
Power supply type is the standard client of fixed power source as connecting object.
When selecting power supply type for the standard client of fixed power source as connecting object, currently connected according to standard client
The main connection of thin-client quantity selection connect and alternative connection.
When in network only one power supply type be fixed power source standard client when, select the standard client as
Connecting object;Meanwhile at least one power supply type of reselection is the standard client of mobile power source as connecting object.
When all mobile power sources of the standard client power supply type in network, two power supply types are selected at least to move
The standard client of dynamic power supply is as connecting object.
When selecting power supply type for the standard client of mobile power source as connecting object, according to electricity from high to low suitable
The main connection of sequence selection and alternative connection.
When selecting power supply type for the standard client of mobile power source as connecting object, currently connected according to standard client
The main connection of thin-client quantity selection connect and alternative connection.
As can be seen from the above-described embodiment, by selecting two standard clients as connecting object, one is the present invention
Main connection, one is alternative connection, when the standard client connection failure with main connection after, can quickly connect and alternatively connect
Standard client ensure that thin-client can quickly access network, save the time of reconnect, improve efficiency.
Although for illustrative purposes, the preferred embodiment of the present invention has been disclosed, those skilled in the art will recognize
It is various improve, increase and replace be also it is possible, therefore, the scope of the present invention should be not limited to the above embodiments.