<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ssh2.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.ssh2-keepalive-config.php',
    1 => 'ssh2_keepalive_config',
    2 => 'Configure how often keepalive messages should be sent',
  ),
  'up' => 
  array (
    0 => 'ref.ssh2.php',
    1 => 'SSH2 Функції',
  ),
  'prev' => 
  array (
    0 => 'function.ssh2-forward-listen.php',
    1 => 'ssh2_forward_listen',
  ),
  'next' => 
  array (
    0 => 'function.ssh2-keepalive-send.php',
    1 => 'ssh2_keepalive_send',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ssh2/functions/ssh2-keepalive-config.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ssh2-keepalive-config" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ssh2_keepalive_config</h1>
  <p class="verinfo">(PECL ssh2 &gt;= 1.5.0)</p><p class="refpurpose"><span class="refname">ssh2_keepalive_config</span> &mdash; <span class="dc-title">Configure how often keepalive messages should be sent</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ssh2-keepalive-config-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>ssh2_keepalive_config</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$session</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$want_reply</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$interval</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="simpara">
   Configures how often keepalive messages are sent on the given
   <code class="parameter">session</code>, and whether the server is asked to reply to
   them.
  </p>
  <p class="simpara">
   Keepalive messages are not sent automatically. Once configured,
   <span class="function"><a href="function.ssh2-keepalive-send.php" class="function">ssh2_keepalive_send()</a></span> must be called to actually send a
   keepalive message.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="simpara">
    This function is only available when the extension is built against a
    libssh2 version providing keepalive support.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ssh2-keepalive-config-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">session</code></dt>
    <dd>
     <p class="simpara">
      An SSH connection link identifier, obtained from a call to
      <span class="function"><a href="function.ssh2-connect.php" class="function">ssh2_connect()</a></span>.
     </p>
    </dd>
   
   
    <dt><code class="parameter">want_reply</code></dt>
    <dd>
     <p class="simpara">
      Whether the server is requested to reply to keepalive messages.
      Requesting a reply makes an unresponsive server detectable, at the cost
      of some extra traffic.
     </p>
    </dd>
   
   
    <dt><code class="parameter">interval</code></dt>
    <dd>
     <p class="simpara">
      The number of seconds that may pass without any traffic before a
      keepalive message should be sent. A value of <code class="literal">0</code>
      disables keepalive messages, and a value of <code class="literal">1</code> is
      treated as <code class="literal">2</code> by the underlying library.
     </p>
     <p class="simpara">
      Accepted values range from <code class="literal">0</code> to
      <code class="literal">4294967295</code>.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ssh2-keepalive-config-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="simpara">
   Не повертає значень.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.ssh2-keepalive-config-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="simpara">
   An <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> is emitted when
   <code class="parameter">interval</code> is outside the accepted range, in which
   case the keepalive configuration is left unchanged.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ssh2-keepalive-config-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 Sending keepalive messages</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$connection </span><span style="color: #007700">= </span><span style="color: #0000BB">ssh2_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'shell.example.com'</span><span style="color: #007700">, </span><span style="color: #0000BB">22</span><span style="color: #007700">);
</span><span style="color: #0000BB">ssh2_auth_password</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">, </span><span style="color: #DD0000">'username'</span><span style="color: #007700">, </span><span style="color: #DD0000">'password'</span><span style="color: #007700">);

</span><span style="color: #FF8000">// Ask the server to reply, after 30 seconds without any traffic
</span><span style="color: #0000BB">ssh2_keepalive_config</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">, </span><span style="color: #0000BB">30</span><span style="color: #007700">);

</span><span style="color: #FF8000">// Keepalive messages are only sent when this function is called
</span><span style="color: #0000BB">ssh2_keepalive_send</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">);
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ssh2-keepalive-config-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.ssh2-keepalive-send.php" class="function" rel="rdfs-seeAlso">ssh2_keepalive_send()</a> - Send a keepalive message</span></li>
   <li><span class="function"><a href="function.ssh2-connect.php" class="function" rel="rdfs-seeAlso">ssh2_connect()</a> - Connect to an SSH server</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>