PHP 8.3.4 Released!

socket_import_stream

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

socket_import_stream导入 stream

说明

socket_import_stream(resource $stream): Socket|false

导入封装了 socket 的 stream 到 socket 扩展资源中。

参数

stream

要导入的 stream 资源。

返回值

发生错误时返回 false

更新日志

版本 说明
8.0.0 成功时,该函数现在返回 Socket 实例;在此之前,返回 resource

示例

示例 #1 socket_import_stream() 示例

<?php
$stream
= stream_socket_server("udp://0.0.0.0:58380", $errno, $errstr, STREAM_SERVER_BIND);
$sock = socket_import_stream($stream);
?>

参见

add a note

User Contributed Notes 1 note

up
4
lcharron at meditech dot com
8 years ago
This function does not support SSL connections.

I have submitted a bug/enhacement request because of this: https://bugs.php.net/bug.php?id=70939
To Top