goba Sun Jul 28 10:04:02 2002 EDT
Added files:
/phpdoc/en/reference/sockets constants.xml
Modified files:
/phpdoc/en/reference/sockets reference.xml
Log:
New structure applied, adding constants here
Index: phpdoc/en/reference/sockets/reference.xml
diff -u phpdoc/en/reference/sockets/reference.xml:1.5
phpdoc/en/reference/sockets/reference.xml:1.6
--- phpdoc/en/reference/sockets/reference.xml:1.5 Sat May 4 00:52:49 2002
+++ phpdoc/en/reference/sockets/reference.xml Sun Jul 28 10:04:01 2002
@@ -1,82 +1,114 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<reference id="ref.sockets">
<title>Socket functions</title>
<titleabbrev>Sockets</titleabbrev>
<partintro>
- &warn.experimental;
- <simpara>
- The socket extension implements a low-level interface to the socket
- communication functions based on the popular BSD sockets, providing the
- possibility to act as a socket server as well as a client.
- </simpara>
- <para>
- The socket functions described here are part of an extension to
- PHP which must be enabled at compile time by giving the <option
- role="configure">--enable-sockets</option> option to
- <command>configure</command>.
- </para>
- <para>
- For a more generic client-side socket interface, see
- <function>fsockopen</function> and
- <function>pfsockopen</function>.
- </para>
- <para>
- When using these functions, it is important to remember that while
- many of them have identical names to their C counterparts, they
- often have different declarations. Please be sure to read the
- descriptions to avoid confusion.
- </para>
- <para>
- The socket extension was written to provide a useable interface to the
- powerful BSD sockets. Care has been taken that the functions work equally
- well on Win32 and Unix implementations. Almost all of the sockets
- functions may fail under certain conditions and therefore emit an
- <constant>E_WARNING</constant> message describing the error. Sometimes this
- doesn't happen to the desire of the developer. For example the function
- <function>socket_read</function> may suddenly emit an
- <constant>E_WARNING</constant> message because the connection broke
- unexpectedly. It's common to suppress the warning with the
- <literal>@</literal>-operator and catch the error code within the
- application with the <function>socket_last_error</function> function. You
- may call the <function>socket_strerror</function> function with this error
- code to retrieve a string describing the error. See their description for
- more information.
- </para>
- <note>
- <para>
- The <constant>E_WARNING</constant> messages generated by the socket
- extension are in english though the retrieved error message will appear
- depending on the current locale (<constant>LC_MESSAGES</constant>):
- <programlisting role="php">
+
+ <section id="sockets.intro">
+ &reftitle.intro;
+ <para>
+ The socket extension implements a low-level interface to the socket
+ communication functions based on the popular BSD sockets, providing the
+ possibility to act as a socket server as well as a client.
+ </para>
+ <para>
+ For a more generic client-side socket interface, see
+ <function>fsockopen</function> and
+ <function>pfsockopen</function>.
+ </para>
+ <para>
+ When using these functions, it is important to remember that while
+ many of them have identical names to their C counterparts, they
+ often have different declarations. Please be sure to read the
+ descriptions to avoid confusion.
+ </para>
+ <para>
+ Those unfamiliar with socket programming can find a lot
+ of useful material in the appropriate Unix man pages, and there is a great
+ deal of tutorial information on socket programming in C on the web, much
+ of which can be applied, with slight modifications, to socket programming
+ in PHP. The <ulink url="http://www.developerweb.net/sock-faq/">UNIX Socket
+ FAQ</ulink> might be a good start.
+ </para>
+ &warn.experimental;
+ </section>
+
+ <section id="sockets.requirements">
+ &reftitle.required;
+ &no.requirement;
+ </section>
+
+ <section id="sockets.installation">
+ &reftitle.install;
+ <para>
+ The socket functions described here are part of an extension to
+ PHP which must be enabled at compile time by giving the <option
+ role="configure">--enable-sockets</option> option to
+ <command>configure</command>.
+ </para>
+ </section>
+
+ <section id="sockets.configuration">
+ &reftitle.runtime;
+ &no.config;
+ </section>
+
+ <section id="sockets.resources">
+ &reftitle.resources;
+ &no.resource;
+ </section>
+
+ &reference.sockets.constants;
+
+ <section id="sockets.errors">
+ <title>Socket Errors</title>
+ <para>
+ The socket extension was written to provide a useable interface to the
+ powerful BSD sockets. Care has been taken that the functions work equally
+ well on Win32 and Unix implementations. Almost all of the sockets
+ functions may fail under certain conditions and therefore emit an
+ <constant>E_WARNING</constant> message describing the error. Sometimes this
+ doesn't happen to the desire of the developer. For example the function
+ <function>socket_read</function> may suddenly emit an
+ <constant>E_WARNING</constant> message because the connection broke
+ unexpectedly. It's common to suppress the warning with the
+ <literal>@</literal>-operator and catch the error code within the
+ application with the <function>socket_last_error</function> function. You
+ may call the <function>socket_strerror</function> function with this error
+ code to retrieve a string describing the error. See their description for
+ more information.
+ </para>
+ <note>
+ <para>
+ The <constant>E_WARNING</constant> messages generated by the socket
+ extension are in english though the retrieved error message will appear
+ depending on the current locale (<constant>LC_MESSAGES</constant>):
+ <programlisting role="php">
<![CDATA[
Warning - socket_bind() unable to bind address [98]: Die Adresse wird bereits
verwendet
]]>
- </programlisting>
- </para>
- </note>
- <para>
- That said, those unfamiliar with socket programming can still find a lot
- of useful material in the appropriate Unix man pages, and there is a great
- deal of tutorial information on socket programming in C on the web, much
- of which can be applied, with slight modifications, to socket programming
- in PHP. The <ulink url="http://www.developerweb.net/sock-faq/">UNIX Socket
- FAQ</ulink> might be a good start.
- </para>
- <para>
- <example>
- <title>Socket example: Simple TCP/IP server</title>
- <para>
- This example shows a simple talkback server. Change the
- <varname>address</varname> and <varname>port</varname> variables
- to suit your setup and execute. You may then connect to the
- server with a command similar to: <command>telnet 192.168.1.53
- 10000</command> (where the address and port match your
- setup). Anything you type will then be output on the server
- side, and echoed back to you. To disconnect, enter 'quit'.
+ </programlisting>
</para>
- <programlisting role="php">
+ </note>
+ </section>
+
+ <section id="sockets.examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>Socket example: Simple TCP/IP server</title>
+ <para>
+ This example shows a simple talkback server. Change the
+ <varname>address</varname> and <varname>port</varname> variables
+ to suit your setup and execute. You may then connect to the
+ server with a command similar to: <command>telnet 192.168.1.53
+ 10000</command> (where the address and port match your
+ setup). Anything you type will then be output on the server
+ side, and echoed back to you. To disconnect, enter 'quit'.
+ </para>
+ <programlisting role="php">
<![CDATA[
#!/usr/local/bin/php -q
<?php
@@ -139,18 +171,18 @@
socket_close ($sock);
?>
]]>
- </programlisting>
- </example>
- </para>
- <para>
- <example>
- <title>Socket example: Simple TCP/IP client</title>
- <para>
- This example shows a simple, one-shot HTTP client. It simply
- connects to a page, submits a HEAD request, echoes the reply,
- and exits.
- </para>
- <programlisting>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title>Socket example: Simple TCP/IP client</title>
+ <para>
+ This example shows a simple, one-shot HTTP client. It simply
+ connects to a page, submits a HEAD request, echoes the reply,
+ and exits.
+ </para>
+ <programlisting>
<![CDATA[
<?php
error_reporting (E_ALL);
@@ -199,6 +231,7 @@
</programlisting>
</example>
</para>
+ </section>
</partintro>
&reference.sockets.functions;
Index: phpdoc/en/reference/sockets/constants.xml
+++ phpdoc/en/reference/sockets/constants.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="sockets.constants">
&reftitle.constants;
&extension.constants;
<variablelist>
<varlistentry>
<term>
<constant>AF_UNIX</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>AF_INET</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOCK_STREAM</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOCK_DGRAM</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOCK_RAW</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOCK_SEQPACKET</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOCK_RDM</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MSG_OOB</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MSG_WAITALL</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MSG_PEEK</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MSG_DONTROUTE</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_DEBUG</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_REUSEADDR</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_KEEPALIVE</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_DONTROUTE</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_LINGER</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_BROADCAST</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_OOBINLINE</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_SNDBUF</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_RCVBUF</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_SNDLOWAT</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_RCVLOWAT</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_SNDTIMEO</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_RCVTIMEO</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_TYPE</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SO_ERROR</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOL_SOCKET</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PHP_NORMAL_READ</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PHP_BINARY_READ</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOL_TCP</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SOL_UDP</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php