mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
0de2e61cab
- Fixed socket_strerror.phpt - Made php_set_sock_blocking return FAILURE on fcntl error. - Made socket_set_block()/socket_set_nonblock() emit warning on error.
27 lines
557 B
PHP
27 lines
557 B
PHP
--TEST--
|
|
socket_import_stream: Basic test
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('sockets')) {
|
|
die('SKIP sockets extension not available.');
|
|
}
|
|
|
|
--FILE--
|
|
<?php
|
|
|
|
$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
|
|
$s = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
|
|
|
|
$s0 = reset($s);
|
|
$s1 = next($s);
|
|
|
|
$sock = socket_import_stream($s0);
|
|
var_dump($sock);
|
|
socket_write($sock, "test message");
|
|
socket_close($sock);
|
|
|
|
var_dump(stream_get_contents($s1));
|
|
--EXPECTF--
|
|
resource(%d) of type (Socket)
|
|
string(12) "test message"
|