Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Client->recv($size = 65535, $flag = 0)
The package size to receive.
Force to close the connection
Receive data from the connection.
If
EOF/Length
checking is enabled, the client will returns the whole package.
OpenSwoole\Client::MSG_WAITALL = 256
This constant is used in the second parameter of method OpenSwoole\Client->recv
. It means that the swoole client will not return untill received the data of specified length.
<?php
$client->recv(8192, OpenSwoole\Client::MSG_PEEK | OpenSwoole\Client::MSG_WAITALL);
OpenSwoole\Client::MSG_DONTWAIT = 64
Receive the data in non-blocking mode.
OpenSwoole\Client::MSG_PEEK = 2
If this constant has been added to the parameter, the recv of client will not change the pointer of recv data and read data from the same offset in next time.
OpenSwoole\Client::MSG_OOB = 1
Receive the out-of-band data.
<?php
$client->recv(8192, OpenSwoole\Client::MSG_PEEK | OpenSwoole\Client::MSG_WAITALL);