Skip to content

streams: add so_rcvbuf and so_sndbuf socket context options. - #23406

Open
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:stream_stf_so_buf
Open

streams: add so_rcvbuf and so_sndbuf socket context options.#23406
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:stream_stf_so_buf

Conversation

@devnexen

Copy link
Copy Markdown
Member

They set SO_RCVBUF and SO_SNDBUF in bytes on TCP and UDP sockets, applied before connect() and listen(). Values outside 1 to INT_MAX throw a ValueError.

They set SO_RCVBUF and SO_SNDBUF in bytes on TCP and UDP sockets, applied
before connect() and listen(). Values outside 1 to INT_MAX throw a ValueError.
@devnexen
devnexen marked this pull request as ready for review August 22, 2026 14:19
@devnexen
devnexen requested a review from bukka as a code owner August 22, 2026 14:19
Comment on lines +11 to +23
} catch (ValueError $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}
}

$context = stream_context_create(['socket' => ['so_rcvbuf' => 0]]);
try {
@stream_socket_client("tcp://127.0.0.1:1", $errno, $errstr, 1,
STREAM_CLIENT_CONNECT, $context);
} catch (ValueError $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (ValueError $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}
}
$context = stream_context_create(['socket' => ['so_rcvbuf' => 0]]);
try {
@stream_socket_client("tcp://127.0.0.1:1", $errno, $errstr, 1,
STREAM_CLIENT_CONNECT, $context);
} catch (ValueError $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
$context = stream_context_create(['socket' => ['so_rcvbuf' => 0]]);
try {
@stream_socket_client("tcp://127.0.0.1:1", $errno, $errstr, 1,
STREAM_CLIENT_CONNECT, $context);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants