GoLang Swoole\Client::connect

request it (11)
GoLang replacement for PHP's Swoole\Client::connect [edit | history]



Do you know a GoLang replacement for PHP's Swoole\Client::connect? Write it!

PHP Swoole\Client::connect

PHP original manual for Swoole\Client::connect [ show | php.net ]

Swoole\Client::connect

(PHP 5 >= 5.2.0, PHP 7, PECL swoole >= 1.9.0)

Swoole\Client::connectConnect to the remote TCP or UDP port.

Description

public bool Swoole\Client::connect ( string $host [, integer $port [, integer $timeout [, integer $flag ]]] )

Parameters

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 dafault 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.

Return Values

Whether the connection is established.