socket_recvmsg
(PHP 5 >= 5.5.0)
socket_recvmsg — Read a message
Description
int socket_recvmsg
( resource
$socket
, string $message
[, int $flags
] )
Warning
This function is currently not documented; only its argument list is available.
Parameters
-
socket
-
-
message
-
-
flags
-
Return Values
- socket_accept
- socket_bind
- socket_clear_error
- socket_close
- socket_cmsg_space
- socket_connect
- socket_create_listen
- socket_create_pair
- socket_create
- socket_get_option
- socket_getopt
- socket_getpeername
- socket_getsockname
- socket_import_stream
- socket_last_error
- socket_listen
- socket_read
- socket_recv
- socket_recvfrom
- socket_recvmsg
- socket_select
- socket_send
- socket_sendmsg
- socket_sendto
- socket_set_block
- socket_set_nonblock
- socket_set_option
- socket_setopt
- socket_shutdown
- socket_strerror
- socket_write
Коментарии
$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);