« Swoole\Client::close
Swoole\Client::__construct »

Swoole\Client::connect

(PECL swoole >= 1.9.0)

Swoole\Client::connect — Connect to the remote TCP or UDP port.

説明

public function Swoole\Client::connect(
    string $host,
    int $port = ?,
    int $timeout = ?,
    int $flag = ?
): bool

パラメータ

host

The host name of the remote address.

port

The port number of the remote address.

timeout

The timeout(second) of connect/send/recv, the default value is 0.1s

flag

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.

戻り値

Whether the connection is established.

関連キーワード:
port   Swoole   Client   connect   remote   flag   client   Connect   host   timeout   swoole   address   send   recv   type   configuration   connection   construct   number   second   default   means   enable   enabled   receive
関連する関数・ページ:
swoole-client.sendto   class.swoole-client   swoole-client.getpeername   swoole-http-client.construct   swoole-client.recv   swoole-client.send