public function acceptUdpConnection($socket)
{
$recv_buffer = stream_socket_recvfrom($socket, self::MAX_UDP_PACKAGE_SIZE, 0, $remote_address);
if (false === $recv_buffer || empty($remote_address)) {
return false;
}
......
}
workman中代碼如上,stream_socket_recvfrom 這個函數(shù)第三個參數(shù)0代表什么意思手冊上沒找到,還有第四個參數(shù)$remote_address上文沒傳過來,這個變量是怎么獲取值的,是服務(wù)器給自己填充的嗎?
關(guān)于stream_socket_recvfrom 的參數(shù)php手冊有。
參見這里 http://php.net/manual/zh/function.stream-socket-recvfrom.php
第四個參數(shù)是引用傳遞,用來獲取對方(這里是客戶端)的ip和端口