stream_socket_pair
reactphp/event-loop
Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Creates a pair of connected, indistinguishable socket streams
stream_socket_pair
(
int $domain
,
int $type
,
int $protocol
): array|
false
public function
createSocketPair
()
{
$domain
= (
DIRECTORY_SEPARATOR
===
'\\'
) ?
STREAM_PF_INET
:
STREAM_PF_UNIX
;
$sockets
=
stream_socket_pair
(
$domain
,
STREAM_SOCK_STREAM
,
STREAM_IPPROTO_IP
);
foreach (
$sockets
as
$socket
) {
if (
function_exists
(
'stream_set_read_buffer'
)) {
tests/AbstractLoopTest.php