mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
24 lines
550 B
Plaintext
24 lines
550 B
Plaintext
|
--TEST--
|
||
|
Check for tcp bind
|
||
|
--FILE--
|
||
|
<?php
|
||
|
define("FIXTURE_PATH", dirname(__FILE__) . "/fixtures/hello.data");
|
||
|
|
||
|
uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||
|
uv_fs_read(uv_default_loop(),$r,function($stream, $nread, $data) {
|
||
|
if ($nread <= 0) {
|
||
|
if ($nread < 0) {
|
||
|
throw new Exception("read error");
|
||
|
}
|
||
|
|
||
|
uv_fs_close(uv_default_loop(), $stream, function(){
|
||
|
});
|
||
|
} else {
|
||
|
echo $data;
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
uv_run();
|
||
|
--EXPECT--
|
||
|
Hello
|