mfischer Tue Apr 30 18:20:20 2002 EDT
Modified files:
/phpdoc/en/reference/sockets/functions socket-strerror.xml
Log:
- Update docs.
Index: phpdoc/en/reference/sockets/functions/socket-strerror.xml
diff -u phpdoc/en/reference/sockets/functions/socket-strerror.xml:1.2
phpdoc/en/reference/sockets/functions/socket-strerror.xml:1.3
--- phpdoc/en/reference/sockets/functions/socket-strerror.xml:1.2 Wed Apr 17
02:44:11 2002
+++ phpdoc/en/reference/sockets/functions/socket-strerror.xml Tue Apr 30 18:20:19
+2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/sockets.xml, last change in rev 1.8 -->
<refentry id="function.socket-strerror">
<refnamediv>
@@ -12,16 +12,15 @@
<type>string</type><methodname>socket_strerror</methodname>
<methodparam><type>int</type><parameter>errno</parameter></methodparam>
</methodsynopsis>
- &warn.experimental.func;
+ &warn.experimental.func;
<para>
<function>socket_strerror</function> takes as its
- <parameter>errno</parameter> parameter the return value of one of
- the socket functions, and returns the corresponding explanatory
- text. This makes it a bit more pleasant to figure out why
- something didn't work; for instance, instead of having to track
- down a system include file to find out what '-111' means, you
- just pass it to <function>socket_strerror</function>, and it tells you
- what happened.
+ <parameter>errno</parameter> parameter a socket error code as returned by
+ <function>socket_last_error</function> and returns the corresponding
+ explanatory text. This makes it a bit more pleasant to figure out why
+ something didn't work; for instance, instead of having to track down a
+ system include file to find out what '-111' means, you just pass it to
+ <function>socket_strerror</function>, and it tells you what happened.
</para>
<para>
<example>
@@ -29,12 +28,12 @@
<programlisting role="php">
<![CDATA[
<?php
-if (($socket = socket_create (AF_INET, SOCK_STREAM, 0)) < 0) {
- echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n";
+if (false == ($socket = @socket_create(AF_INET, SOCK_STREAM, 0))) {
+ echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) .
+"\n";
}
-if (($ret = socket_bind ($socket, '127.0.0.1', 80)) < 0) {
- echo "socket_bind() failed: reason: " . socket_strerror ($ret) . "\n";
+if (false == (@socket_bind($socket, '127.0.0.1', 80))) {
+ echo "socket_bind() failed: reason: " .
+socket_strerror(socket_last_error($socket)) . "\n";
}
?>
]]>