ID:               16819
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
-Bug Type:         Sockets related
+Bug Type:         Documentation problem
 Operating System: Windows' 9x
 PHP Version:      4.1.2
 New Comment:

Yes, known thx. It's a documentation issue.


Previous Comments:
------------------------------------------------------------------------

[2002-04-25 06:13:40] [EMAIL PROTECTED]

1) in your documentation
(http://www.php.net/manual/en/function.socket-connect.php)

"socket_connect" function described as:


int socket_connect ( resource socket, string address [, int port])


but in your binaries (extensions/php_sockets.dll) and in
source codes (/ext/sockets/socket.c) this function returns 0(false) or
1(true):

...
if (retval != 0)
{
  PHP_SOCKET_ERROR(php_sock, "unable to connect", errno);
  RETURN_FALSE;
}
RETURN_TRUE;
...


Also "Example 2. Socket example: Simple TCP/IP client"
(http://www.php.net/manual/en/ref.sockets.php) is wrong:

...
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
    echo "socket_create() failed: reason: " . socket_strerror ($socket)
. "\n";
} else {
    echo "OK.\n";
}
...


Must be something like this:

>>
...
if ($socket == 0) {
...




2) Function "socket_connect" (/ext/sockets/socket.c) calls function
php_error:


....
php_error(E_WARNING, "%s() %s [%d]: %s",
get_active_function_name(TSRMLS_C), msg, errn, php_strerror(errn));
...


but last parameter is not a pointer to string, it's an integer number
(equals to "errn"), because "php_strerror(errn)" can not return error
message (function "FormatMessage" fails).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16819&edit=1

Reply via email to