update docs [ci skip]

This commit is contained in:
Shuhei Tanuma 2012-07-16 01:34:41 +09:00
parent 35d57e6b35
commit ccd0c57305
2 changed files with 170 additions and 1 deletions

View File

@ -184,6 +184,7 @@ starts read callback for uv resources.
##### *Parameters* ##### *Parameters*
*resource $handle*: uv resources (uv_tcp, uv_udp, uv_pipe ...etc.) *resource $handle*: uv resources (uv_tcp, uv_udp, uv_pipe ...etc.)
*callable $callback*: callable variables. this callback parameter expects (resource $handle, long $nread, string buffer) *callable $callback*: callable variables. this callback parameter expects (resource $handle, long $nread, string buffer)
##### *Return Value* ##### *Return Value*
@ -207,12 +208,94 @@ starts read callback for uv resources.
### resource uv_ip4_addr(string $ipv4_addr, long $port) ### resource uv_ip4_addr(string $ipv4_addr, long $port)
##### *Description*
create a ipv4 sockaddr.
##### *Parameters*
*string $ipv4_addr*: ipv4 address
*long $port*: port number.
##### *Return Value*
*resource $uv_sockaddr*: sockaddr resource
##### *Example*
````php
<?php
$sockaddr = uv_ip4_addr("127.0.0.1", 8080);
````
### resource uv_ip6_addr(string $ipv6_addr, long $port) ### resource uv_ip6_addr(string $ipv6_addr, long $port)
##### *Description*
create a ipv6 sockaddr.
##### *Parameters*
*string $ipv6_addr*: ipv6 address
*long $port*: port number.
##### *Return Value*
*resource $uv_sockaddr*: sockaddr resource
##### *Example*
````php
<?php
$sockaddr = uv_ip6_addr("::1", 8080);
````
### void uv_listen(resource $handle, long $backlog, callable $callback) ### void uv_listen(resource $handle, long $backlog, callable $callback)
##### *Description*
listens for a connection on a uv handle.
##### *Parameters*
*resource $handle*: uv resource handle (tcp, udp and pipe)
*long $backlog*: backlog
*callable $callback*: this callback parameter expects (resource $connection, long $status)
##### *Return Value*
*void *:
##### *Example*
````php
<?php
$tcp = uv_tcp_init();
uv_tcp_bind($tcp, uv_ip4_addr('0.0.0.0',9999));
uv_listen($tcp,100, function($server, $status){
$client = uv_tcp_init();
uv_accept($server, $client);
uv_read_start($client, function($socket, $nread, $buffer) use ($server){
var_dump($buffer);
uv_close($socket);
uv_close($server);
});
});
uv_run();
````
### void uv_tcp_connect(resource $handle, resource $ipv4_addr, callable $callback) ### void uv_tcp_connect(resource $handle, resource $ipv4_addr, callable $callback)
@ -781,7 +864,9 @@ var_dump(uv_cwd());
##### *Description* ##### *Description*
returns current cpu informations. returns current cpu informations
.
##### *Parameters* ##### *Parameters*
@ -818,6 +903,7 @@ var_dump(uv_cpu_info());
```` ````
### array uv_interface_addresses(void) ### array uv_interface_addresses(void)

View File

@ -2936,6 +2936,7 @@ starts read callback for uv resources.
##### *Parameters* ##### *Parameters*
*resource $handle*: uv resources (uv_tcp, uv_udp, uv_pipe ...etc.) *resource $handle*: uv resources (uv_tcp, uv_udp, uv_pipe ...etc.)
*callable $callback*: callable variables. this callback parameter expects (resource $handle, long $nread, string buffer) *callable $callback*: callable variables. this callback parameter expects (resource $handle, long $nread, string buffer)
##### *Return Value* ##### *Return Value*
@ -3045,6 +3046,28 @@ PHP_FUNCTION(uv_read_stop)
/* }}} */ /* }}} */
/* {{{ proto resource uv_ip4_addr(string $ipv4_addr, long $port) /* {{{ proto resource uv_ip4_addr(string $ipv4_addr, long $port)
##### *Description*
create a ipv4 sockaddr.
##### *Parameters*
*string $ipv4_addr*: ipv4 address
*long $port*: port number.
##### *Return Value*
*resource $uv_sockaddr*: sockaddr resource
##### *Example*
````php
<?php
$sockaddr = uv_ip4_addr("127.0.0.1", 8080);
````
*/ */
PHP_FUNCTION(uv_ip4_addr) PHP_FUNCTION(uv_ip4_addr)
{ {
@ -3069,6 +3092,28 @@ PHP_FUNCTION(uv_ip4_addr)
/* }}} */ /* }}} */
/* {{{ proto resource uv_ip6_addr(string $ipv6_addr, long $port) /* {{{ proto resource uv_ip6_addr(string $ipv6_addr, long $port)
##### *Description*
create a ipv6 sockaddr.
##### *Parameters*
*string $ipv6_addr*: ipv6 address
*long $port*: port number.
##### *Return Value*
*resource $uv_sockaddr*: sockaddr resource
##### *Example*
````php
<?php
$sockaddr = uv_ip6_addr("::1", 8080);
````
*/ */
PHP_FUNCTION(uv_ip6_addr) PHP_FUNCTION(uv_ip6_addr)
{ {
@ -3094,6 +3139,44 @@ PHP_FUNCTION(uv_ip6_addr)
/* {{{ proto void uv_listen(resource $handle, long $backlog, callable $callback) /* {{{ proto void uv_listen(resource $handle, long $backlog, callable $callback)
##### *Description*
listens for a connection on a uv handle.
##### *Parameters*
*resource $handle*: uv resource handle (tcp, udp and pipe)
*long $backlog*: backlog
*callable $callback*: this callback parameter expects (resource $connection, long $status)
##### *Return Value*
*void *:
##### *Example*
````php
<?php
$tcp = uv_tcp_init();
uv_tcp_bind($tcp, uv_ip4_addr('0.0.0.0',9999));
uv_listen($tcp,100, function($server, $status){
$client = uv_tcp_init();
uv_accept($server, $client);
uv_read_start($client, function($socket, $nread, $buffer) use ($server){
var_dump($buffer);
uv_close($socket);
uv_close($server);
});
});
uv_run();
````
*/ */
PHP_FUNCTION(uv_listen) PHP_FUNCTION(uv_listen)
{ {