class Client (View source)

Constants

MSG_OOB

MSG_PEEK

MSG_DONTWAIT

MSG_WAITALL

SHUT_RDWR

SHUT_RD

SHUT_WR

Properties

$errCode
$sock
$reuse
$reuseCount
$type
$id
$setting

Methods

__construct($type, $async = null, $id = null)

No description

__destruct()

No description

mixed
set(array $settings)

No description

mixed
connect(mixed $host, mixed|null $port = null, mixed|null $timeout = null, mixed|null $sock_flag = null)

No description

mixed
recv(mixed|null $size = null, mixed|null $flag = null)

No description

mixed
send(mixed $data, mixed|null $flag = null)

No description

mixed
sendfile(mixed $filename, mixed|null $offset = null, mixed|null $length = null)

No description

mixed
sendto(mixed $ip, mixed $port, mixed $data)

No description

mixed
shutdown(mixed $how)

No description

mixed
enableSSL()

No description

mixed
getPeerCert()

No description

mixed
verifyPeerCert()

No description

mixed
isConnected()

No description

mixed
getsockname()

No description

mixed
getpeername()

No description

mixed
close(mixed|null $force = null)

No description

mixed
getSocket()

No description

Details

__construct($type, $async = null, $id = null)

No description

Parameters

$type
$async
$id

__destruct()

No description

mixed set(array $settings)

No description

Parameters

array $settings

Return Value

mixed

mixed connect(mixed $host, mixed|null $port = null, mixed|null $timeout = null, mixed|null $sock_flag = null)

No description

Parameters

mixed $host

The host name of the remote address.

mixed|null $port

The port number of the remote address.

mixed|null $timeout

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

mixed|null $sock_flag

Return Value

mixed

Whether the connection is established.

mixed recv(mixed|null $size = null, mixed|null $flag = null)

No description

Parameters

mixed|null $size
mixed|null $flag

Return Value

mixed

mixed send(mixed $data, mixed|null $flag = null)

No description

Parameters

mixed $data

The data to send which can be string or binary

mixed|null $flag

Return Value

mixed

If the client sends data successfully, it returns the length of data sent. Or it returns false and sets $swoole_client->errCode. For sync client, there is no limit for the data to send. For async client, The limit for the data to send is socket_buffer_size.

mixed sendfile(mixed $filename, mixed|null $offset = null, mixed|null $length = null)

No description

Parameters

mixed $filename

File path of the file to send.

mixed|null $offset

Offset of the file to send

mixed|null $length

Return Value

mixed

mixed sendto(mixed $ip, mixed $port, mixed $data)

No description

Parameters

mixed $ip

The IP address of remote host, IPv4 or IPv6.

mixed $port

The port number of remote host.

mixed $data

The data to send which should be less-than 64K.

Return Value

mixed

mixed shutdown(mixed $how)

No description

Parameters

mixed $how

Return Value

mixed

mixed enableSSL()

No description

Return Value

mixed

mixed getPeerCert()

No description

Return Value

mixed

mixed verifyPeerCert()

No description

Return Value

mixed

mixed isConnected()

No description

Return Value

mixed

Whether the connection is established.

mixed getsockname()

No description

Return Value

mixed

The host and port of the local socket.

mixed getpeername()

No description

Return Value

mixed

The host and port of the remote socket.

mixed close(mixed|null $force = null)

No description

Parameters

mixed|null $force

Whether force to close the connection.

Return Value

mixed

Whether the connection is closed.

mixed getSocket()

No description

Return Value

mixed