swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.47k stars 3.16k forks source link

[Question] How to specify the buffer size of the tcp coroutine server? #4806

Closed beef9999 closed 2 years ago

beef9999 commented 2 years ago

The code is in https://openswoole.com/docs/modules/swoole-coroutine-server#quick-start-example

$data = $conn->recv();

Looks like the buffer is dynamically allocated. How can I specify the buffer to a fixed size?

matyhtf commented 2 years ago

The $conn is the Swoole\Coroutine\Socket object, the first parameter of recv can set the buffer size