array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), '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); ?>
(PECL swoole >= 1.9.0)
Swoole\Client::connect — Connect to the remote TCP or UDP port.
hostThe host name of the remote address.
portThe port number of the remote address.
timeoutThe timeout(second) of connect/send/recv, the dafault value is 0.1s
flagIf 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.
Whether the connection is established.