1--TEST--
2swoole_socket_coro: iov max
3--SKIPIF--
4<?php require __DIR__ . '/../include/skipif.inc'; ?>
5--FILE--
6<?php
7
8use Swoole\Coroutine\Socket;
9
10use function Swoole\Coroutine\run;
11
12require __DIR__ . '/../include/bootstrap.php';
13
14run(function () {
15    $iovector = [];
16    $iovectorLength = [];
17
18    for ($i = 0; $i < SWOOLE_IOV_MAX + 1; $i++) {
19        $iovector[$i] = 'a';
20    }
21
22    for ($i = 0; $i < SWOOLE_IOV_MAX + 1; $i++) {
23        $iovectorLength[$i] = 1;
24    }
25
26    $conn = new Socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
27    Assert::false($conn->writeVectorAll($iovector));
28    Assert::eq($conn->errCode, SOCKET_EINVAL);
29    Assert::eq($conn->errMsg, "The maximum of iov count is " . SWOOLE_IOV_MAX);
30
31    Assert::false($conn->readVectorAll($iovectorLength));
32    Assert::eq($conn->errCode, SOCKET_EINVAL);
33    Assert::eq($conn->errMsg, "The maximum of iov count is " . SWOOLE_IOV_MAX);
34});
35
36echo "DONE\n";
37?>
38--EXPECT--
39DONE
40