PHP 8.4.0 RC4 available for testing

socket_recvmsg

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

socket_recvmsgRead a message

说明

socket_recvmsg(Socket $socket, array &$message, int $flags = 0): int|false

警告

本函数还未编写文档,仅有参数列表。

参数

socket

message

flags

返回值

更新日志

版本 说明
8.0.0 现在 socketSocket 实例, 之前是 resource

参见

添加备注

用户贡献的备注 1 note

up
-1
251701981 at qq dot com
1 year ago
$sockets = [];
\socket_create_pair(AF_UNIX,SOCK_DGRAM,0,$sockets);

$proc = new \Swoole\Process(function()use($sockets){

socket_close($sockets[0]);

$f = fopen(__FILE__,'r');
var_dump($f);
socket_sendmsg($sockets[1],[ 'control'=>[['level'=>SOL_SOCKET,'type'=>SCM_RIGHTS,'data'=>[$f]] ] ],0);
sleep(10);

},false,2,1);

$proc->start();

socket_close($sockets[1]);

$data = [
'controllen'=>socket_cmsg_space(SOL_SOCKET,SCM_RIGHTS,1)
];

socket_recvmsg($sockets[0],$data,0);

var_dump($data);

sleep(10);
To Top