- Update docs.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@80647 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Markus Fischer 2002-04-30 22:20:19 +00:00
parent 62776e05a7
commit 3967896ad4

View file

@ -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";
}
?>
]]>