mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-12104 attempt
using stream_select to gives the chance to process the data. close GH-14311
This commit is contained in:
@@ -21,8 +21,14 @@ $data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
|
||||
$fd = stream_socket_client("udp://localhost:$port", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
|
||||
stream_set_blocking($fd, 0);
|
||||
stream_socket_sendto($fd, $data);
|
||||
$read = array($server);
|
||||
$write = null;
|
||||
$exc = null;
|
||||
if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
|
||||
stream_socket_recvfrom($server, 1, 0, $peer);
|
||||
stream_socket_sendto($server, $data, 0, $peer);
|
||||
$read = array($fd);
|
||||
if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
|
||||
$ret = stream_get_contents($fd, 65565);
|
||||
var_dump(strlen($ret) > 0);
|
||||
stream_socket_shutdown($fd, STREAM_SHUT_RDWR);
|
||||
|
||||
Reference in New Issue
Block a user