<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.radius.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.radius-add-server.php',
    1 => 'radius_add_server',
    2 => 'Adds a server',
  ),
  'up' => 
  array (
    0 => 'ref.radius.php',
    1 => 'Radius 函数',
  ),
  'prev' => 
  array (
    0 => 'function.radius-acct-open.php',
    1 => 'radius_acct_open',
  ),
  'next' => 
  array (
    0 => 'function.radius-auth-open.php',
    1 => 'radius_auth_open',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/radius/functions/radius-add-server.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.radius-add-server" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">radius_add_server</h1>
  <p class="verinfo">(PECL radius &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">radius_add_server</span> &mdash; <span class="dc-title">Adds a server</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.radius-add-server-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>radius_add_server</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$radius_handle</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$hostname</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$port</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$secret</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$timeout</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$max_tries</code></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   <span class="function"><strong>radius_add_server()</strong></span> may be called multiple times, and it
   may be used together with <span class="function"><a href="function.radius-config.php" class="function">radius_config()</a></span>. At most 10
   servers may be specified. When multiple servers are given, they are tried
   in round-robin fashion until a valid response is received, or until each
   server&#039;s <code class="parameter">max_tries</code> limit has been reached.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.radius-add-server-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">radius_handle</code></dt>
    <dd>
     <span class="simpara">
     </span>
    </dd>
   
   
    <dt><code class="parameter">hostname</code></dt>
    <dd>
     <span class="simpara">
      The <code class="parameter">hostname</code> parameter specifies the server host,
      either as a fully qualified domain name or as a dotted-quad IP address
      in text form.
     </span>
    </dd>
   
   
    <dt><code class="parameter">port</code></dt>
    <dd>
     <p class="para">
      The <code class="parameter">port</code> specifies the UDP port to contact on
      the server. If port is given as 0, the library looks up the
      <code class="systemitem systemitem">radius/udp</code> or
      <code class="systemitem systemitem">radacct/udp</code> service in the
      network services database, and uses the port found there.  If no entry
      is found, the library uses the standard Radius ports, 1812 for
      authentication and 1813 for accounting.
     </p>
    </dd>
   
   
    <dt><code class="parameter">secret</code></dt>
    <dd>
     <span class="simpara">
      The shared secret for the server host is passed to the
      <code class="parameter">secret</code> parameter. The Radius protocol ignores
      all but the leading 128 bytes of the shared secret.
     </span>
    </dd>
   
   
    <dt><code class="parameter">timeout</code></dt>
    <dd>
     <span class="simpara">
      The timeout for receiving replies from the server is passed to the
      <code class="parameter">timeout</code> parameter, in units of seconds.
     </span>
    </dd>
   
   
    <dt><code class="parameter">max_tries</code></dt>
    <dd>
     <span class="simpara">
      The maximum number of repeated requests to make before giving up is
      passed into the <code class="parameter">max_tries</code>.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.radius-add-server-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   成功时返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>， 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.radius-add-server-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>radius_add_server()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">radius_add_server</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">, </span><span style="color: #DD0000">'radius.example.com'</span><span style="color: #007700">, </span><span style="color: #0000BB">1812</span><span style="color: #007700">, </span><span style="color: #DD0000">'testing123'</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">'RadiusError:' </span><span style="color: #007700">. </span><span style="color: #0000BB">radius_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">). </span><span style="color: #DD0000">"\n&lt;br&gt;"</span><span style="color: #007700">;<br />    exit;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.radius-add-server-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.radius-config.php" class="function" rel="rdfs-seeAlso">radius_config()</a> - Causes the library to read the given configuration file</span></li>
  </ul>
 </div>

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