How to define sleeping timeout for remote 4D applications

To prevent session loss, 4D monitors the sleeping state of remote 4D applications.

When a user is connected from a remote 4D application to a 4D Server and their computer goes into sleep mode, the information is sent to 4D Server. At the moment the user’s computer wakes up, the remote 4D application then recovers its execution context.

Checking the STATE OF REMOte 4D applications

The sleeping state of a remote 4D application is displayed in the Server Administration window, in Users > Activity:

Another way to detect sleeping remote 4D applications is to use the Get process activity command:
$sleepingRemotes:=Get process activity (Sessions only).sessions.query(“state = :1”;”sleeping”)

HOW IT WORKs

While in sleeping mode, all resources consumed by the remote 4D are still allocated to it, to retrieve its working state when waking up. Processes, licenses, opened transactions, locked records, etc, are freed only when the remote 4D session ends.
To prevent sessions from remaining in sleeping mode for too long, 4D Server automatically closes all remote 4D sessions that have been asleep for more than 48 hours.

If you want to manage this timeout more precisely, depending on your customer’s usage, you can use the SET DATABASE PARAMETER command with the Remote connection sleep timeout selector. Note that the timeout shall be set in seconds and that the value is not stored, so you need to set your own timeout at the restart. It can even be set indifferently on the remote 4D and 4D Server, since the value takes effect only on the 4D Server side for all the remote 4D applications.

Sleeping checks for remote 4D applications are performed every 5 minutes on the 4D Server.

Example

defaultTimeout:=Get database parameter(Remote connection sleep timeout) // 172800 seconds by default
SET DATABASE PARAMETER(Remote connection sleep timeout; 7200) // Set to 2 hours

Note: sleeping mode management is not available with the legacy network layer.

Avatar
• Product Owner •Damien Fuzeau has joined the 4D Product team in February 2019. As a Product Owner, he is in charge of writing user stories, then translating them to functional specifications. His job also entails making sure that the feature implementations delivered are meeting the customer needs.Damien is graduated from the University of Nantes in software engineering. He spent more than 23 years in its former company, first as developer (discovering 4D in 1997), and later as engineering manager and software architect. This company is a 4D OEM partner and deployed 4D based business softwares for thousands users, on hundreds servers. So, Damien is used to 4D development and deployment in a multi-language context.