<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="120" MadCap:lastWidth="624" MadCap:disableMasterStylesheet="true" MadCap:tocPath="Client-Server" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem"> <head><title>Client-Server Timeouts</title> <script type="text/javascript">/* <![CDATA[ */ window.onload = function(){ var pathToFlash = $('html').attr('MadCap:PathToHelpSystem') + 'Content/Resources/Code/ZeroClipboard.swf'; ZeroClipboard.setMoviePath(pathToFlash); function bindToClipBord(element,content){ var clip = new ZeroClipboard.Client(); clip.setText(content); clip.glue(element); }; if(location.protocol==='file:'){ $('.copylink-marker').remove(); } else{ $('.copylink-marker').each(function(){ var text = $(this).parent().parent().children('.prettyprint').html(); $(this).hover(function(){ bindToClipBord(this,text); }, function(){}); }); } prettyPrint(); }; /* ]]> */</script> <link href="../SkinSupport/MadCap.css" rel="stylesheet" /> <link href="../Resources/Stylesheets/OnlineStyle.css" rel="stylesheet" /> <script src="../Resources/Code/prettify.js"> </script> <script src="../Resources/Code/lang-vb.js"> </script> <script src="../Resources/Code/jquery.min.js"> </script> <script src="../Resources/Code/ZeroClipboard.js"> </script> <script src="../SkinSupport/MadCapAll.js" type="text/javascript"> </script> </head> <body> <p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../index_CSH.html#client-server/client-server_timeouts.htm" style="">Open topic with navigation</a> </p> <div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../client-server.htm">Client-Server</a><span class="MCBreadcrumbsDivider"> > </span><span class="MCBreadcrumbs">Client-Server Timeouts</span> </div> <p> <script type="text/javascript">/*<![CDATA[*/document.write('<a href="' + location.href +'">'); document.write("Direct Link"); document.write('</a>');/*]]>*/</script> </p> <p> </p> <h1><a name="kanchor67"></a>Client-Server Timeouts</h1>Every client/server application has to face a problem of network communications. Luckily modern protocols screen the end-application from all fixable problems. However there are still physical reasons that can't be fixed by a protocol: disconnections, power failures, crash of a system on the other end of communication channel etc. In these cases it is still the responsibility of the client-server application to exit the connection gracefully, releasing all resources and protecting data. <p>In order to achieve an efficient client/server communication and handling of connection problems the following requirements were defined for db4o:</p><ul><li value="1">The connection should not be terminated when both client and server are still alive, even if either of the machines is running under heavy load. </li><li value="2">Whenever a client dies, peacefully or with a crash, the server should clean up all resources that were reserved for the client. </li><li value="3">Whenever a server goes offline, it should be possible for the client to detect that there is a problem. </li><li value="4">Since many clients may be connected at the same time, it makes sense to be careful with the resources the server reserves for each client. </li><li value="5">A client can be a very small machine, so it would be good if the client application can work with a single thread.</li></ul><p>Unfortunately all the requirements are difficult to achieve for a cross-platform application, as Java and .NET sockets behave differently.</p><p>The current approach tries to keep things as simple as possible: any connection is closed immediately upon a timeout. In order to prevent closing connections when there is no communication between client and server due to reasons different from connection problems a separate timer thread was created to send messages to the server at a regular basis. The server must reply to the thread immediately, if this does not happen the communication channel gets closed. </p><p>This approach works effectively for both client and server side. However there's are small downside to this. When a server operation takes longer than the timeout, the connection will be closed. You can configure the timeouts for the <a href="../configuration/client/timeout_client_socket.htm">client</a> and the <a href="../configuration/server_configuration.htm">server</a>.</p><p>An easy rule of thumb: </p><ul><li value="1">If you experience clients disconnecting, raise the timeout value.</li><li value="2">If you have a system where clients crash frequently or where the network is very instable, lower the values, so resources for disconnected clients are freed faster.</li></ul><script type="text/javascript" src="../SkinSupport/MadCapBodyEnd.js"></script></body> </html>