<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.swoole-client.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'swoole-client.connect.php',
    1 => 'Swoole\\Client::connect',
    2 => 'Connect to the remote TCP or UDP port.',
  ),
  'up' => 
  array (
    0 => 'class.swoole-client.php',
    1 => 'Swoole\\Client',
  ),
  'prev' => 
  array (
    0 => 'swoole-client.close.php',
    1 => 'Swoole\\Client::close',
  ),
  'next' => 
  array (
    0 => 'swoole-client.construct.php',
    1 => 'Swoole\\Client::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/swoole/swoole/client/connect.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="swoole-client.connect" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Swoole\Client::connect</h1>
  <p class="verinfo">(PECL swoole &gt;= 1.9.0)</p><p class="refpurpose"><span class="refname">Swoole\Client::connect</span> &mdash; <span class="dc-title">Connect to the remote TCP or UDP port.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-swoole-client.connect-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Swoole\Client::connect</strong></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">$host</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 class="initializer"> = ?</span></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 class="initializer"> = ?</span></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">$flag</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">

  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-swoole-client.connect-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">host</code></dt>
    <dd>
     <p class="para">
      The host name of the remote address.
     </p>
    </dd>
   
   
    <dt><code class="parameter">port</code></dt>
    <dd>
     <p class="para">
      The port number of the remote address.
     </p>
    </dd>
   
   
    <dt><code class="parameter">timeout</code></dt>
    <dd>
     <p class="para">
      The timeout(second) of connect/send/recv, the default value is 0.1s
     </p>
    </dd>
   
   
    <dt><code class="parameter">flag</code></dt>
    <dd>
     <p class="para">
      If the type of client is UDP, the $flag means if to enable the configuration udp_connect. 
      If the configuration udp_connect is enabled, the client will only receive the data from specified ip:port.
      If the type of client is TCP and the $flag is set to 1, it must use swoole_client_select to check the connection status before send/recv.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-swoole-client.connect-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Whether the connection is established.
  </p>
 </div>



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