embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment mono-
The embodiment of the present invention provides the method for a kind of office terminal state, referring to Fig. 1.
It should be noted that, the embodiment of the present invention is take end side as executive agent, sends corresponding information according to the state of current terminal applies to server.
Method flow comprises:
101: terminal applies connects by the server in mode and the home network of telemanagement while startup;
102: in the time that described terminal applies is switched to backstage by foreground, sends and switch background state information to described server, make described server suspend to terminal corresponding to described terminal applies and send remote subscriber interface data according to described switching background state information.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.
Embodiment bis-
The embodiment of the present invention provides the method for a kind of office terminal state, referring to Fig. 2.
It should be noted that, the embodiment of the present invention is take server side as executive agent, manages the state of connected terminal.
Method flow comprises:
201: the terminal corresponding with terminal applies connects;
202: be while switching background state information when receiving the state information of described terminal transmission, suspend to terminal corresponding to described terminal applies and send remote subscriber interface data.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.
Embodiment tri-
The embodiment of the present invention provides the method for a kind of office terminal state, referring to Fig. 3.
It should be noted that, the present invention is to the illustrating of embodiment mono-and embodiment bis-, and by the interaction flow between end side and server side, the mode of the office terminal state in the embodiment of the present invention is described in detail.
Method flow comprises:
301: terminal applies connects by the server in mode and the home network of telemanagement while startup.
After terminal applies starts, after terminal connects by data network and server, server can send remote subscriber interface data to terminal applies by data network.
In the time that terminal and first server connect, terminal is set up a heartbeat object listing, for storing and the mark of the server of its maintenance connection status, by this heartbeat object listing, terminal can be safeguarded the connection status of connected one or more servers.In the time that server and first terminal connect, server is set up a terminal list, for storing and the mark of the terminal of its maintenance connection status, wherein in terminal list, also preserve the state information of the mark correspondence of each terminal, so that server judges whether to send remote subscriber interface data to terminal according to the state information of each terminal.In server, be provided with timer, can send heartbeat message to each connected terminal respectively and carry out timing, do not receive the heartbeat message of terminal transmission when exceeding the preassigned time, to these terminal cumulative record expired times.
In the time that terminal connects other servers, need this server identification add heartbeat object listing so that terminal according to heart beat cycle to the Servers-all transmission heartbeat message being connected with its maintenance in heartbeat object listing; In the time that terminal disconnects with the server being connected, need server identification corresponding in heartbeat object listing to delete, after this no longer send heartbeat message to this server.
Further, terminal creates heartbeat send-thread, for according to the preassigned time, sends heartbeat message to connected server.Server end starts heartbeat watcher thread, the heartbeat message sending for receiving connected terminal to server.
302: the terminal that server is corresponding with terminal applies connects.
303: terminal sends heartbeat message every Preset Time to described server, for maintaining the presence of terminal corresponding to described terminal applies at described server, at least there is a station server in described heartbeat message in wherein said home network.
Terminal is carried out timing according to preassigned heart beat cycle, in the time that heart beat cycle corresponding to timer arrives, the all servers that connect to terminal send respectively heartbeat message, wherein heartbeat message is for maintaining the presence of terminal at each server, the terminal that sends this heartbeat message with notification server is in normal operating conditions, in server, continue to keep the normal presence connecting, need server to send remote subscriber interface data to it.In embodiments of the present invention, heartbeat message is by UDP(User Datagram Protocol, User Datagram Protocol) agreement sends to server.
Further, at least comprise the mark of the terminal that sends heartbeat message in heartbeat message, the heartbeat message that server is sent different terminals is distinguished, to upgrade terminal that each heartbeat message the is corresponding state in server.
Therefore step 303 can be specially:
3031: carry out timing according to preassigned heart beat cycle.
3032: the mark of obtaining described server.
Wherein, in embodiments of the present invention, obtaining the step that keeps the mark of the server being connected with terminal, is the mark of obtaining each server in the heartbeat object listing by setting up in terminal.
3033: whenever heart beat cycle arrives, terminal sends described heartbeat message according to the mark of described server to described server.
304: server receives the heartbeat message that terminal corresponding to described terminal applies sends.
305: server, according to the heartbeat message of terminal transmission corresponding to described terminal applies, arranges the state of terminal corresponding to described terminal applies.
Concrete, the heartbeat message sending by resolving terminal, obtain the terminal iidentification that sends this heartbeat message in heartbeat message, the heartbeat message that definite terminal that is which is connected with server sends, maintains the presence of this terminal in server by this heartbeat message.
Determine the state of terminal in server according to heartbeat message, so that server judges whether to send remote subscriber interface data to terminal according to this state.Because terminal is to send heartbeat message according to the preassigned time to server under normal circumstances, therefore when server is received after the heartbeat message of a certain connected terminal transmission, obtain by resolving heartbeat message the terminal iidentification comprising in this heartbeat message, to maintain the presence of the terminal that in the terminal list creating in server, this terminal iidentification is corresponding.If due to the problem of the factors such as network, make the heartbeat message that this terminal sends within the preassigned time, normally not be sent to server, in server, can record so this terminal once overtime.
After this, if server is not received the heartbeat message that this terminal sends again within the preassigned time, the overtime number of times of cumulative record, in the time that overtime number of times reaches preassigned threshold value continuously, judge that this terminal and server disconnect, the state that this terminal terminal list in server is set is off-line state.
If server has been received the heartbeat message that terminal is sent when timer corresponding to certain terminal is not overtime, or server record terminal expired times for once or continuous several times do not receive heartbeat message, but while not exceeding preassigned threshold number, receive again heartbeat message, so now server confirms that under both of these case, terminal is presence, and this terminal is reset at timer corresponding to server and expired times.
Determining that after the state of terminal in server, the state by terminal corresponding terminal iidentification in the terminal list of server upgrades.
Therefore, step 305 can be specially:
3051: if receive the heartbeat message that terminal corresponding to described terminal applies sends within the preassigned time, server determines that terminal corresponding to described terminal applies is presence, continues normally to send remote subscriber interface data to terminal corresponding to described terminal applies;
3052: if do not receive within the preassigned time when number of times of heartbeat message does not exceed preassigned threshold number, receive the heartbeat message that terminal corresponding to described terminal applies sends, described in Servers installed, terminal corresponding to terminal applies is presence, continues normally to send remote subscriber interface data to terminal corresponding to described terminal applies;
3053: if server is not received when the number of times of heartbeat message exceedes preassigned threshold number within the preassigned time, do not receive the heartbeat message that terminal corresponding to described terminal applies sends, described in Servers installed, the state of terminal corresponding to terminal applies is off-line state, no longer sends remote subscriber interface data to terminal corresponding to described terminal applies.
Further, if after terminal all disconnects connected Servers-all, now the heartbeat object listing in terminal is empty, now heartbeat object listing is deleted, and is destroyed heartbeat send-thread.If after all terminals and server disconnect, now the terminal list in server is empty, now terminal list is deleted, and is destroyed heartbeat watcher thread.
306: the time-out count of resetting terminal corresponding to described terminal applies.
After server instep 3052 has been received the heartbeat message that terminal sends, although now timer has carried out overtime immediately to this terminal, now recover again transmission heartbeat message, the timer of this terminal of therefore resetting.
307: in the time that described terminal applies is switched to backstage by foreground, sends and switch background state information to described server, make described server suspend to terminal corresponding to described terminal applies and send remote subscriber interface data according to described switching background state information.
When terminal applies is in backstage or minimized state, now user cannot operate and without the program of the upper remote subscriber interface of operating terminal application, therefore now this terminal applies is not need to accept remote subscriber interface data.Therefore after terminal applies is placed in backstage or minimizes now in non-normal use state, send to server the information that switches to non-normal use state, wherein this switches to the terminal iidentification that carries this terminal in the information of non-normal use state, and notification server is now without sending remote subscriber interface data to terminal corresponding to this terminal iidentification.
308: be while switching background state information when receiving the state information of described terminal transmission, server time-out sends remote subscriber interface data to terminal corresponding to described terminal applies.
In the time that server receives the message of switching state of terminal transmission, according to the particular content of the status message switching, correspondence arranges this terminal state parameter in terminal list in server, make in the time of server issuing message, according to the state of each terminal in terminal list, only send message to the terminal of presence.Wherein, the signaling process figure that SOT state of termination is set as shown in Figure 4.
Concrete execution mode is: in the time receiving the message that switches to background state that terminal sends, in the terminal list of server, state corresponding this terminal iidentification is changed to background state from presence, now server, in sending remote subscriber interface data according to terminal list, does not send remote subscriber interface data to the terminal in background state.
309: in the time that described terminal applies is switched to foreground by backstage, sends and switch foreground state information to described server, make described server recover to send remote subscriber interface data to terminal corresponding to described terminal applies according to described switching foreground state information.
When terminal applies is from backstage or minimize while changing normal operating condition into, send to server the information that switches to normal operating condition, wherein this switches to the terminal iidentification that carries this terminal in the information of normal operating condition, and notification server now sends remote subscriber interface data to terminal again.
310: be while switching foreground state information when receiving the state information of described terminal transmission, server recovers to send remote subscriber interface data to terminal corresponding to described terminal applies.
In the time receiving the message that switches to foreground state that terminal sends, in the terminal list of server, state corresponding this terminal iidentification is changed to presence from background state, now server is according to the end message in terminal list, in the time that each information transmission cycle arrives, send remote subscriber interface data to the terminal that is in line states.
311: in the time that described terminal applies exits, send and exit information to described server, make described server no longer send remote subscriber interface data to terminal corresponding to described terminal applies.
Wherein, exit in information and can comprise terminal iidentification, make server confirm identity according to terminal iidentification.Server receives this and exits after information, according to this terminal iidentification, in the terminal list in server, end message corresponding this terminal iidentification is deleted, and makes server no longer send remote subscriber interface data to this terminal in the next information transmission cycle.
312: receive the information that exits that terminal corresponding to described terminal applies sends, the state of terminal corresponding to described terminal applies is set to off-line state, no longer sends remote subscriber interface data to terminal corresponding to described terminal applies.
Server exits in information the terminal receiving, extracts the identity of terminal iidentification confirmation terminal, is set to off-line state according to the state of definite terminal identity its corresponding terminal in terminal list.After this, server can not send remote subscriber interface data to the terminal of off-line state in the time of the information of transmission.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.And send heartbeat message by each server to being connected with terminal, realized terminal and maintained and the connection status of multiple servers simultaneously, the terminal applies that having avoided breaks causes cannot operate the phenomenon of home network resource, improved user's experience.
Embodiment tetra-
Referring to Fig. 5, the embodiment of the present invention provides the terminal of a kind of office terminal state, and this terminal comprises:
Module 501 is set up in the first connection, while startup, connects by the mode of telemanagement and the server of home network for terminal applies;
Switchbackground state module 502, for in the time that described terminal applies is switched to backstage by foreground, send and switch background state information to described server, make described server suspend to terminal corresponding to described terminal applies and send remote subscriber interface data according to described switching background state information.
In embodiment, preferred, described terminal also comprises:
Switch foreground block ofstate 503, for in the time that described terminal applies is switched to foreground by backstage, send and switch foreground state information to described server, make described server recover to send remote subscriber interface data to terminal corresponding to described terminal applies according to described switching foreground state information.
Preferably, described terminal also comprises:
Heartbeatmessage sending module 504, for sending heartbeat message every Preset Time to described server, for maintaining the presence of terminal corresponding to described terminal applies at described server, in wherein said home network, at least there is a station server in described heartbeat message.
Wherein, described heartbeatmessage sending module 504, comprising:
Timing unit 5041, for carrying out timing according to preassigned heart beat cycle;
Acquiring unit 5042, for obtaining the mark of described server;
Transmitting element 5043, for whenever heart beat cycle arrives, sends described heartbeat message according to the mark of described server to described server.
Preferably, described terminal also comprises:
Exit processing module 505, in the time that described terminal applies exits, send and exit information to described server, make described server no longer send remote subscriber interface data to terminal corresponding to described terminal applies.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.And send heartbeat message by each server to being connected with terminal, realized terminal and maintained and the connection status of multiple servers simultaneously, the terminal applies that having avoided breaks causes cannot operate the phenomenon of home network resource, improved user's experience.
Embodiment five
Referring to Fig. 6, the embodiment of the present invention provides the server of a kind of office terminal state, and this server comprises:
Module 601 is set up in the second connection, connects for the terminal corresponding with terminal applies;
Background state arrangesmodule 602, for being while switching background state information when receiving the state information of described terminal transmission, suspends to terminal corresponding to described terminal applies and sends remote subscriber interface data.
In embodiment, preferred, described server also comprises:
Foregroundstate setting module 603, for being while switching foreground state information when receiving the state information of described terminal transmission, recovers to send remote subscriber interface data to terminal corresponding to described terminal applies.
Preferably, described server also comprises:
Receiver module 604, the heartbeat message sending for receiving terminal corresponding to described terminal applies;
Processing module 605, for the heartbeat message sending according to terminal corresponding to described terminal applies, arranges the state of terminal corresponding to described terminal applies.
Wherein, describedprocessing module 605, comprising:
The first processing unit 6051, if for the heartbeat message of receiving that within the preassigned time terminal corresponding to described terminal applies sends, determine that terminal corresponding to described terminal applies is presence, continue normally to send remote subscriber interface data to terminal corresponding to described terminal applies;
The second processing unit 6052, if while not exceeding preassigned threshold number for the number of times of not receiving heartbeat message within the preassigned time, receive the heartbeat message that terminal corresponding to described terminal applies sends, it is presence that terminal corresponding to described terminal applies is set, and continues normally to send remote subscriber interface data to terminal corresponding to described terminal applies;
The 3rd processing unit 6053, if while exceeding preassigned threshold number for the number of times of not receiving heartbeat message within the preassigned time, do not receive the heartbeat message that terminal corresponding to described terminal applies sends, the state that terminal corresponding to described terminal applies is set is off-line state, no longer sends remote subscriber interface data to terminal corresponding to described terminal applies.
Preferably, described server also comprises:
Counter replacement module 606, for the time-out count of resetting terminal corresponding to described terminal applies.
Preferably, described server comprises:
Off-line state arrangesmodule 607, the information that exits sending for receiving terminal corresponding to described terminal applies, the state of terminal corresponding to described terminal applies is set to off-line state, no longer sends remote subscriber interface data to terminal corresponding to described terminal applies.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.And send heartbeat message by each server to being connected with terminal, realized terminal and maintained and the connection status of multiple servers simultaneously, the terminal applies that having avoided breaks causes cannot operate the phenomenon of home network resource, improved user's experience.
Embodiment six
Referring to Fig. 7, the embodiment of the present invention provides the system of a kind of office terminal state, and this server comprises: terminal 701 andserver 702; It is characterized in that,
Described terminal 701 comprises:
Module 7011 is set up in the first connection, while startup, connects by the mode of telemanagement and the server of home network for terminal applies;
Switchbackground state module 7012, for in the time that described terminal applies is switched to backstage by foreground, send and switch background state information to described server, make described server suspend to terminal corresponding to described terminal applies and send remote subscriber interface data according to described switching background state information;
Describedserver 702 comprises:
Module 7021 is set up in the second connection, connects for the terminal corresponding with terminal applies;
Background state arrangesmodule 7022, for being while switching background state information when receiving the state information of described terminal transmission, suspends to terminal corresponding to described terminal applies and sends remote subscriber interface data.
The embodiment of the present invention is by the time that terminal applies switches to background state by foreground state, send the information of change state to server, make server can know the current residing state of terminal applies, and judge whether to send remote subscriber interface data to terminal corresponding to terminal applies according to the state of terminal applies, save network traffics.And send heartbeat message by each server to being connected with terminal, realized terminal and maintained and the connection status of multiple servers simultaneously, the terminal applies that having avoided breaks causes cannot operate the phenomenon of home network resource, improved user's experience.
One of ordinary skill in the art will appreciate that all or part of step that realizes above-described embodiment can complete by hardware, also can carry out the hardware that instruction is relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be read-only memory, disk or CD etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.