# Patent

## Title
Method for providing a connection of a client to an unmanaged service in a client-server remote access system

## Abstract

Systems and methods for providing a connection of a client to an unmanaged service in a client-server remote access system. An unmanaged service may register at a remote access server and open a communication connection there between remote access server may be configured for providing remote access to the unmanaged service by a client. The remote access server receives keep-alive messages from the unmanaged service over the communication connection, which may serve to indicate that the unmanaged service is operational. The remote access server may a request for a client connection to the unmanaged service, after which, a terminate keep-alive message is communicated to the unmanaged service to terminate the sending of keep-alive messages from the unmanaged service in response to the request for the client connection to the unmanaged service.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims priority to U.S. Provisional Patent Application No. 61/910,189, filed Nov. 29, 2013, entitled “METHOD FOR SERVER-SERVICE SEPARATION WITH END-TO-END FLOW CONTROL IN A CLIENT-SERVER REMOTE ACCESS ENVIRONMENT,” and U.S. Provisional Patent Application No. 61/944,720, filed Feb. 26, 2014, entitled “ METHOD FOR PROVIDING A CONNECTION OF A CLIENT TO AN UNMANAGED SERVICE IN A CLIENT-SERVER REMOTE ACCESS SYSTEM.” The disclosures of the above are incorporated herein by reference in their entireties.


BACKGROUND
Ubiquitous remote access to services has become commonplace as a result of the growth and availability of broadband and wireless network access. As such, users are accessing services using an ever-growing variety of client devices (e.g., mobile devices, tablet computing devices, laptop/notebook/desktop computers, etc.). A remote server may communicate messages that contain data or other information between services and client devices over a variety of networks including, 3G and 4G mobile data networks, wireless networks such as WiFi and WiMax, wired networks, etc.
The services may be deployed on the same system node or computing device as an integrated remote access and application server, which also hosts a server remote access program to which client devices communicate. In other instances, services may be deployed on servers provided at different system nodes from the remote access server executing the server remote access program. While such environments provide deployment of large numbers of services, as well as a lighter weight installation and configuration process, there are problems associated with maintaining an operational statuses of such services at the remote access server.
SUMMARY
Disclosed herein are systems and methods for providing unmanaged services with a keep-alive mechanism to determine if the unmanaged service is operational. In accordance with an aspect of the disclosure, there is provided a method for providing connection of a client to an unmanaged service in a client-server remote access system. The method may include registering the unmanaged service at a remote access server and creating a communication connection there between, the remote access server being configured for providing remote access to the unmanaged service by a client; receiving keep-alive messages at the remote access server from the unmanaged service over the communication connection; receiving a request at the remote access server for a client connection to the unmanaged service; and communicating a terminate keep-alive message from the remote access server to the unmanaged service to terminate the sending of keep-alive messages from the unmanaged service in response to the request for the client connection to the unmanaged service.
In accordance with other aspects of the disclosure, another method for providing a connection of a client to an unmanaged service in a client-server remote access system is disclosed. The method may include executing the unmanaged service at a first application server; opening a communication connection between the unmanaged service and a remote access server; providing information to a remote access server to register the unmanaged service at the remote access server, the remote access server being configured for providing remote access to the unmanaged service by a client; communicating keep-alive messages from the unmanaged service to the remote access server over the communication connection; and terminating the keep-alive messages from the unmanaged service in response to receiving an instruction.
In accordance with yet other aspects of the disclosure, an apparatus for providing a connection of a client to an unmanaged service in a client-server remote access system is disclosed. The apparatus may include a remote access server having a server layer that is a communications proxy for messages sent between the client and the unmanaged service, and an application server executing a service layer associated with the unmanaged service. The remote access server receives keep-alive messages from the unmanaged service over a communication connection, wherein the remote access server receives a request for a client connection to the unmanaged service. The remote access server may also communicate a terminate keep-alive message to the unmanaged service to terminate the sending of keep-alive messages from the unmanaged service in response to the request for the client connection to the unmanaged service.
In accordance with other aspects, there is provided a method for providing a connection of a client to an unmanaged service in a client-server remote access system. The method may include executing the unmanaged service at a first application server; opening a communication connection between the unmanaged service and a remote access server; providing initial headers information to a remote access server to register the unmanaged service at the remote access server, the remote access server being configured for providing remote access to the first unmanaged service by a client; communicating keep-alive messages from the unmanaged service to the remote access server over the communication connection ; and terminating the keep-alive messages from the unmanaged service in response to a receiving an instruction request for a client connection at the remote access server.
Other systems, methods, features and/or advantages will be or may become apparent to one with skill in the art upon examination of the following drawings and detailed description. It is intended that all such additional systems, methods, features and/or advantages be included within this description and be protected by the accompanying claims.



BRIEF DESCRIPTION OF THE DRAWINGS
The components in the drawings are not necessarily to scale relative to each other. Like reference numerals designate corresponding parts throughout the several views.
FIGS. 1A and 1B, illustrate example server-service models for client remote access to services in a layered architecture;
FIG. 2 illustrates a call flow diagram illustrating a sequence of messages that are sent between threads running in the unmanaged service and the remote access server to implement the keep-alive messaging of the present disclosure;
FIG. 3 illustrates operational flow diagrams of processes performed by an unmanaged service to implement the keep-alive messaging shown in FIG. 2;
FIG. 4 illustrates an operational flow diagram of processes performed by a remote access server to implement the keep-alive messaging shown in FIG. 2; and
FIG. 5 illustrates an exemplary computing device.



DETAILED DESCRIPTION
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. Methods and materials similar or equivalent to those described herein can be used in the practice or testing of the present disclosure. While implementations will be described for remotely accessing services, it will become evident to those skilled in the art that the implementations are not limited thereto, but are applicable for remotely accessing any type of data or service via a remote device.
With the above overview as an introduction, reference is now made to FIGS. 1A and 1B, which illustrate examples of managed and unmanaged server-service models for client remote access to services in a layered architecture. As shown in FIG. 1A (managed service model), a client 102 having a client layer 112 may communicate to a remote access and application server 103 that includes a server layer 114 and a service layer 116. As such, the server layer 114 and service layer 116 execute on the same system node. The client layer 112 may include a client application, e.g., a web browser, dedicated application, etc., used to provide a user interface at the client 102 that displays information from a connected service or services. The client application may connect to a service using an application ID or application name. The client 102 may be wireless handheld devices such as, for example, an IPHONE, an ANDROID-based device, a tablet device or a desktop/notebook personal computer that are connected by a communication network 125 to the remote access and application server 103.
The remote access and application server 103 may include a server remote access program that executes in the server layer 114. The server remote access program is used to connect the client 102 to a managed service 115 (e.g., an application) executing in the service layer 116. By “managed service,” it is meant that remote access and application server 103 controls the application/process life cycle by starting and stopping the managed service 115 as clients connect and disconnect. For example, the managed service 115 may be a medical imaging application. Within the remote access and application server 103, the server remote access program in the server layer 114 may be connected to the service in the service layer 116 using a TCP socket connection and by, e.g., a system bus of the remote access and application server 103. Thus, bandwidth between the server remote access program and the service is extremely high. To provide additional services or application in the environment of FIG. 1A, additional service layers 116 are deployed on the remote access and application server 103. Alternatively, additional remote access and application servers 103 having additional server layers 114 and service layers 116 may be added. An example of the client 102 and the remote access and application server 103 is shown in FIG. 5.
Referring now to FIG. 1B (unmanaged service model), there is illustrated an example of a service-server model in which a remote access server 104 includes the server layer 114 in which the server remote access program executes. An application server 106 includes the service layer 116 in which the service or application executes. In the environment of FIG. 1B, the service (shown as unmanaged service 117) is provided on a system node or computing device that is a different system node or a computing device on which the server remote access program executes. The unmanaged service 117 communicates over a communication connection 126 to the remote access server 104. Thus, the service is on a node separate from the server. As used herein, an “unmanaged service” is an application that may reside on a same or different node (e.g., server) than the remote access server 104, but whose application/process life cycle is not managed by the remote access server 104. Rather, an external entity (the end user, or another process or application) launches the service outside of the remote access server.
The communication connection 126 may be a TCP/IP communications network, a VPN connection, a dedicated connection, etc. Such environments provide for deployment of large numbers of services, as service deployment is not limited by the capabilities of the remote access and application server 103 of FIG. 1A. As such, services can be created and destroyed in accordance with needs, therefore providing scalability. An example of the remote access server 104 and the application server 106 is shown in FIG. 5.
In FIG. 1B, the client 102 connects to the remote access server 104 over communication connection 125. The application server 106 may connect to the remote access server 104 at a predetermined Internet Protocol (IP) address and/or socket, or using a Uniform Resource Locator (URL) associated with the remote access server 104 to register the service or application with the server remote access program executing on the remote access server 104. The service, on startup, connects to the server using a server-service socket connection (described in more detail below) and establishes the session as a queued and unmanaged application to which a client may connect.
In the environment of FIG. 1B, the unmanaged service 117 may register with the remote access server 104 prior to a client 102 connected to the unmanaged service 117. Initially, a remotely accessible application (i.e., the unmanaged service 117) is launched at the application server 106. Herein, “remotely accessible” may be defined as an application that has been designed to run with a remote access toolkit provided as part of a Software Development Kit (SDK) implemented in the service layer 116. The unmanaged service 117 then connects to the remote access server 104 and registers therewith to create a communication there between. The remotely accessible application is now a “queued service,” as it is ready to be connected to by one or more clients 102. The queued service is known by a unique application name (for a single type of remotely accessible application) and/or a unique application instanceId that is unique to the queued service connection.
The client 102 may connect to the unmanaged service 117 by connecting to the remote access server 104, as described above. In connecting to the remote access server 104, the client 102 may either connect to a specific instance of the queued service by using the application instanceId or connect to the first available queued service of a particular type using the application name. The remote access server 104 then facilitates the mechanics of connecting the client 102 to the queued service. Once the client is connected, the queued service is upgraded it to an “active service.” Additional clients may connect to the active services by using the unique application instanceId whereby the connected clients may collaborate together with the active service. Additional services may be provided by adding additional application servers 106 that each communicate to the remote access server 104 over respective communication connections 126. For example, a second (or more) application server 106 may be added to host a second (or more) unmanaged service 117.
In both FIGS. 1A and 1B, the server remote access program may provide for connection marshalling and application process management. An example of the server remote access program is PUREWEB, available from Calgary Scientific, Inc. of Calgary, Alberta, Canada.
In accordance with aspects of the present disclosure, when an unmanaged service deployment is implemented as shown in FIG. 1B, there may be a need for the remote access server 104 to know if the unmanaged service 117 is disconnected or hung-up during a client connection process. Accordingly, a keep-alive mechanism may be provided whereby the unmanaged service 117 sends keep-alive messages to the remote access server 104 during the time when the unmanaged service 117 is first queued and before a client 102 connects.
With reference to FIG. 2, there is illustrated a call flow diagram illustrating a sequence of messages that are sent between threads running in the unmanaged service 117 and the remote access server 104 to implement the keep-alive mechanism of the present disclosure. The remote access server 104 starts a monitor thread 206 to monitor the keep-alive messages from the unmanaged service 117 to detect if the unmanaged service 117 has gone away by determining that a keep-alive message has not been received within a configurable time interval or if the server-service socket connection between the remote access server 104 and the unmanaged service 117 has unexpectedly closed. If the server-service socket connection is lost, the client 102 disconnects its server session, which in turn, causes the remote access server 104 to close the server-service socket and purge the unmanaged service 117 from the system.
However, the keep-alive messaging may cause problems if the client 102 connects to the unmanaged service 117 while the keep-alive messaging is being performed, as there will be two threads writing simultaneously to the server-service socket. In particular, once the client 102 is connected, the remote access server 104 starts a thread to read service responses from the server-service socket to send back to the client 102. Before this thread is started, the remote access server 104 needs to ensure the monitor thread 206 is shutdown so there is only one thread reading from the server-service socket at a time. Otherwise the monitor thread runs the risk of consuming a response intended for the client 120 which may break the client-service request/response protocol. The remote access server 104 also needs to ensure that the unmanaged service 117 has stopped sending keep-alive messages, which might otherwise be communicated to the client 112. Here, the client 102 would not know what to do with the keep-alive message.
Thus, in accordance with the present disclosure, the keep-alive messaging is shut down just before the client 102 connects to the unmanaged service 117. A handshake process may be implemented that takes place between the remote access server 104 and the unmanaged service 117 to shutdown the keep-alive messages in an orderly fashion when the client 102 is connecting, such that normal processing can proceed, i.e., the service input/output threads transition from sending keep-alive messages to receiving client input and sending service responses. In this manner, there is a handoff of one thread to another in the socket.
FIG. 2 illustrates a call flow diagram illustrating a sequence of messages that are sent between threads running in the unmanaged service and the remote access server to implement the keep-alive messaging of the present disclosure. FIG. 3 illustrates an operational flow diagram 300 of processes performed by the remote access server 104 to implement the keep-alive messaging shown in FIG. 2. FIG. 4 illustrates operational flow diagrams 400 and 420 of processes performed by the unmanaged service 117 to implement the keep-alive messaging shown in FIG. 2. The operational flows 300, 400 and 420 may be executed simultaneously by the remote access server 104 and unmanaged service 117 to implement keep-alive messaging as introduced above.
As shown in FIG. 2 and FIG. 4, when the unmanaged service 117 connects to the remote access server 104, an input thread 202 and an output thread 204 are started, which execute the operational flows 400 and 420, respectively. At 422, an application ID, process name and process ID (i.e., information associated with the unmanaged service 117) is sent as initial headers to the remote access server 104 (at 424). As shown in FIG. 3, this information (from 422) is received by the remote access server 104 at 304. At 306, the remote access server 104 registers the unmanaged service 117. Next, the monitor thread 206 is started and begins its operational flow, as shown in 300.
The output thread 204 begins a loop at 426 where keep-alive messages are sent, the output thread 204 waits a configurable amount of time (e.g., 500 ms at 428) and determines if a stop sending keep-alives has been received (at 430, from the remote access server 104, described below). If the stop sending keep-alives has not been received, the loop returns to 426. If a stop sending keep-alives has been received, then the sending of keep-alive messages is stopped by the output thread 204 at 432. It is noted that the wait time at 428 is configurable and may be a time period other than 500 ms.
Concurrently with the above, the monitor thread 206 operates in a loop at 312 to start a timer at 314, read the keep-alive message from the output thread 204 (at 318) and cancel the timer at 320. This loop is performed during the period of time when the unmanaged service 117 is connected to the remote access server 104, but before a client connection is received. If the timer started at 314 expires before a keep-alive message is received, then at 316, the socket associated with the unmanaged service 117 is closed and the service is unregistered, as it is assumed the unmanaged service 117 has gone away.
Concurrent with the operation of the loop at 312, at 308, it may be determined by the remote access server 104 that a client is connecting to the remote access server 104 to remotely access the unmanaged service 117 (e.g., a connection from the client 102 at the URL of the remote access server 104). The determination at 308 may be determined at any time after the unmanaged service 117 connects to the remote access server 104 as shown in FIG. 2. At 310, the remote access server 104 sends a message to the input thread 202 to stop sending keep-alive messages. This message is received by the input thread at 402, which sets a stopSendingKeepAlives value to “true” at 404. At 406, the input thread 202 notifies the output thread 204 that it should stop sending keep-alive messages.
The output thread 204, at 430, determines if a notification from the input thread 202 indicates to stop sending keep-alive messages. The output thread 204, upon receipt of the notification to stop sending keep-alive messages, stops at 432 and sends a “keep-alive=false” to the monitor thread 206. The output thread waits and then loops to process client requests (at 434) until the client disconnects. The remote access server 104 stops the monitor thread and sends an acknowledgement to the input thread 202 at 322, which is received at 408. The remote access server 104 completes the connection to the client 102 at 324. The input thread 202 loops to process client request (at 410) until the client disconnects.
Thus, the above is an example mechanism by which keep-alive messages may be communicated to a socket to determine that the unmanaged service 117 is responsive that also enables a client to connect to the same socket without creating confusion between the keep-alive messaging and the client connection process.
FIG. 5 shows an exemplary computing environment in which example embodiments and aspects may be implemented. The computing system environment is only one example of a suitable computing environment and is not intended to suggest any limitation as to the scope of use or functionality.
Numerous other general purpose or special purpose computing system environments or configurations may be used. Examples of well-known computing systems, environments, and/or configurations that may be suitable for use include, but are not limited to, personal computers, servers, handheld or laptop devices, multiprocessor systems, microprocessor-based systems, network personal computers (PCs), minicomputers, mainframe computers, embedded systems, distributed computing environments that include any of the above systems or devices, and the like.
Computer-executable instructions, such as program modules, being executed by a computer may be used. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Distributed computing environments may be used where tasks are performed by remote processing devices that are linked through a communications network or other data transmission medium. In a distributed computing environment, program modules and other data may be located in both local and remote computer storage media including memory storage devices.
With reference to FIG. 5, an exemplary system for implementing aspects described herein includes a computing device, such as computing device 500. In its most basic configuration, computing device 500 typically includes at least one processing unit 502 and memory 504. Depending on the exact configuration and type of computing device, memory 504 may be volatile (such as random access memory (RAM)), non-volatile (such as read-only memory (ROM), flash memory, etc.), or some combination of the two. This most basic configuration is illustrated in FIG. 5 by dashed line 506.
Computing device 500 may have additional features/functionality. For example, computing device 500 may include additional storage (removable and/or non-removable) including, but not limited to, magnetic or optical disks or tape. Such additional storage is illustrated in FIG. 5 by removable storage 508 and non-removable storage 510.
Computing device 500 typically includes a variety of tangible computer readable media. Computer readable media can be any available tangible media that can be accessed by device 500 and includes both volatile and non-volatile media, removable and non-removable media.
Tangible computer storage media include volatile and non-volatile, and removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Memory 504, removable storage 508, and non-removable storage 510 are all examples of computer storage media. Tangible computer storage media include, but are not limited to, RAM, ROM, electrically erasable program read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computing device 500. Any such computer storage media may be part of computing device 500.
Computing device 500 may contain communications connection(s) 512 that allow the device to communicate with other devices. Computing device 500 may also have input device(s) 514 such as a keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s) 516 such as a display, speakers, printer, etc. may also be included. All these devices are well known in the art and need not be discussed at length here.
It should be understood that the various techniques described herein may be implemented in connection with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus of the presently disclosed subject matter, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the presently disclosed subject matter. In the case of program code execution on programmable computers, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. One or more programs may implement or utilize the processes described in connection with the presently disclosed subject matter, e.g., through the use of an application programming interface (API), reusable controls, or the like. Such programs may be implemented in a high level procedural or object-oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language and it may be combined with hardware implementations.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

## Claims

1. A method for providing connection of a client to an unmanaged service in a client-server remote access system, comprising:
registering the unmanaged service at a remote access server and creating a communication connection there between, the remote access server being configured for providing remote access to the unmanaged service by a client;
receiving keep-alive messages at the remote access server from the unmanaged service over the communication connection;
receiving a request at the remote access server for a client connection to the unmanaged service; and
communicating a terminate keep-alive message from the remote access server to the unmanaged service to terminate the sending of keep-alive messages from the unmanaged service in response to the request for the client connection to the unmanaged service.

2. The method of claim 1, further comprising executing at the remote access server a monitor thread to receive the keep-alive messages and monitor for the request for the client connection.

3. The method of claim 2, further comprising:
determining if the keep-alive messages are being sent by the unmanaged service;
starting a timer for a predetermined period of time;
determining if a keep-alive message has been received within the predetermined period of time; and
if the keep-alive message was not received, unregistering the unmanaged service; and
if the keep-alive message was received, canceling the timer and looping back to the determining step.

4. The method of claim 3, further comprising closing the communication connection.

5. The method of claim 2, further comprising communicating from the remote access server an acknowledgement to the unmanaged service that the monitor thread has stopped.

6. The method of claim 1, wherein the unmanaged service executes on a computing device other than the remote access server.

7. The method of claim 1, wherein the unmanaged service executes on the remote access server.

8. A method for providing a connection of a client to an unmanaged service in a client-server remote access system, comprising:
executing the unmanaged service at a first application server;
opening a communication connection between the unmanaged service and a remote access server;
providing information to a remote access server to register the unmanaged service at the remote access server, the remote access server being configured for providing remote access to the unmanaged service by a client;
communicating keep-alive messages from the unmanaged service to the remote access server over the communication connection; and
terminating the keep-alive messages from the unmanaged service in response to receiving an instruction.

9. The method of claim 8, further comprising communicating the keep-alive messages from the unmanaged service to the remote access at a predetermined time interval.

10. The method of claim 8, further comprising executing an output thread and an input thread at the unmanaged service, wherein the output thread sends the keep-alive messages to the remote access server, and wherein the input thread receives an instruction to stop sending the keep-alive messages.

11. The method of claim 10, further comprising servicing the client connection after terminating the keep-alive messages, the servicing being performed by the input thread and the output thread.

12. The method of claim 8, wherein the first application server and the remote access server are the same computing device.

13. The method of claim 8, wherein the first application server is a computing device other than a computing device associated with the remote access server.

14. The method of claim 8, wherein the instruction is received from a remote access server.

15. The method of claim 14, wherein the instruction is received in response to a request for a client connection at the remote access server.

16. The method of claim 8, further comprising:
executing at least a second unmanaged service at at least a second application server;
creating a second communication connection between the at least second unmanaged service and the remote access server;
providing information to a remote access server to register the at least second unmanaged service at the remote access server, the remote access server being configured for providing remote access to the at least second unmanaged service by a client;
communicating keep-alive messages from the at least second unmanaged service to the remote access server over the second communication connection; and
terminating the keep-alive messages from the at least second unmanaged service in response to receiving an instruction.

17. An apparatus for providing a connection of a client to an unmanaged service in a client-server remote access system, further comprising:
a remote access server having a server layer that is a communications proxy for messages sent between the client and the unmanaged service;
an application server executing a service layer associated with the unmanaged service,
wherein the remote access server receives keep-alive messages from the unmanaged service over a communication connection, wherein the remote access server receives a request for a client connection to the unmanaged service, and wherein the remote access server communicates a terminate keep-alive message to the unmanaged service to terminate the sending of keep-alive messages from the unmanaged service in response to the request for the client connection to the unmanaged service.

18. The apparatus of claim 17, wherein the remote access server executes a monitor thread to receive the keep-alive messages and monitor for the request for the client connection.

19. The apparatus of claim 18, wherein the remote access server determines if the keep-alive messages are being sent by the unmanaged service by starting a timer for a predetermined period of time, and wherein if the keep-alive message was not received within the predetermined period of time, the remote access server unregisters the unmanaged service.

20. The apparatus of claim 17, wherein the remote access server and the application server maintain message queues associated with the unmanaged service to communicate messages once the client connection is established.