nicobn Fri Aug 17 15:17:30 2007 UTC
Modified files: /phpdoc/en/reference/sockets/functions socket-sendto.xml socket-send.xml socket-recvfrom.xml Log: Corrected the table and removed unapplicable flags. Also added a better description.
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/sockets/functions/socket-sendto.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/sockets/functions/socket-sendto.xml diff -u phpdoc/en/reference/sockets/functions/socket-sendto.xml:1.10 phpdoc/en/reference/sockets/functions/socket-sendto.xml:1.11 --- phpdoc/en/reference/sockets/functions/socket-sendto.xml:1.10 Sat Jul 21 17:55:08 2007 +++ phpdoc/en/reference/sockets/functions/socket-sendto.xml Fri Aug 17 15:17:30 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-sendto"> <refnamediv> <refname>socket_sendto</refname> @@ -58,22 +58,31 @@ <term><parameter>flags</parameter></term> <listitem> <para> - The value of <parameter>flags</parameter> can be one of the - following: + The value of <parameter>flags</parameter> can be any combination of + the following flags, joined with the binary OR (<literal>|</literal>) + operator. <table> - <title>possible values for <parameter>flags</parameter></title> + <title>Possible values for <parameter>flags</parameter></title> <tgroup cols="2"> <tbody> <row> <entry><constant>MSG_OOB</constant></entry> <entry> - Process OOB (out-of-band) data. + Send OOB (out-of-band) data. </entry> </row> <row> - <entry><constant>MSG_PEEK</constant></entry> + <entry><constant>MSG_EOR</constant></entry> <entry> - Peek at incoming message. + Indicate a record mark. The sent data completes the record. + </entry> + </row> + <row> + <entry><constant>MSG_EOF</constant></entry> + <entry> + Close the sender side of the socket and include an appropriate + notification of this at the end of the sent data. The sent data + completes the transaction. </entry> </row> <row> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/sockets/functions/socket-send.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/sockets/functions/socket-send.xml diff -u phpdoc/en/reference/sockets/functions/socket-send.xml:1.9 phpdoc/en/reference/sockets/functions/socket-send.xml:1.10 --- phpdoc/en/reference/sockets/functions/socket-send.xml:1.9 Thu Aug 16 13:08:29 2007 +++ phpdoc/en/reference/sockets/functions/socket-send.xml Fri Aug 17 15:17:30 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-send"> <refnamediv> <refname>socket_send</refname> @@ -56,40 +56,37 @@ <term><parameter>flags</parameter></term> <listitem> <para> - The value of <parameter>flags</parameter> can be any - <literal>ORed</literal> combination of the following: + The value of <parameter>flags</parameter> can be any combination of + the following flags, joined with the binary OR (<literal>|</literal>) + operator. <table> - <title>possible values for <parameter>flags</parameter></title> + <title>Possible values for <parameter>flags</parameter></title> <tgroup cols="2"> <tbody> <row> <entry><constant>MSG_OOB</constant></entry> <entry> - Process OOB (out-of-band) data + Send OOB (out-of-band) data. </entry> </row> <row> - <entry><constant>MSG_PEEK</constant></entry> - <entry> - Peek at incoming message - </entry> - </row> - <row> - <entry><constant>MSG_DONTROUTE</constant></entry> + <entry><constant>MSG_EOR</constant></entry> <entry> - Bypass routing, use direct interface + Indicate a record mark. The sent data completes the record. </entry> </row> <row> - <entry><constant>MSG_EOR</constant></entry> + <entry><constant>MSG_EOF</constant></entry> <entry> - Data completes record + Close the sender side of the socket and include an appropriate + notification of this at the end of the sent data. The sent data + completes the transaction. </entry> </row> <row> - <entry><constant>MSG_EOF</constant></entry> + <entry><constant>MSG_DONTROUTE</constant></entry> <entry> - Data completes transaction + Bypass routing, use direct interface. </entry> </row> </tbody> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/sockets/functions/socket-recvfrom.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/sockets/functions/socket-recvfrom.xml diff -u phpdoc/en/reference/sockets/functions/socket-recvfrom.xml:1.12 phpdoc/en/reference/sockets/functions/socket-recvfrom.xml:1.13 --- phpdoc/en/reference/sockets/functions/socket-recvfrom.xml:1.12 Mon Jun 25 19:40:11 2007 +++ phpdoc/en/reference/sockets/functions/socket-recvfrom.xml Fri Aug 17 15:17:30 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-recvfrom"> <refnamediv> <refname>socket_recvfrom</refname> @@ -76,13 +76,13 @@ <term><parameter>flags</parameter></term> <listitem> <para> - The following table contains the different flags that can be set using - the <parameter>flags</parameter> parameter. Use the OR logic operator - (<literal>|</literal>) to use more than one flag. + The value of <parameter>flags</parameter> can be any combination of + the following flags, joined with the binary OR (<literal>|</literal>) + operator. </para> <table> - <title>Available flags</title> + <title>Possible values for <parameter>flags</parameter></title> <tgroup cols="2"> <thead> <row> @@ -92,20 +92,20 @@ </thead> <tbody> <row> - <entry>MSG_OOB</entry> + <entry><constant>MSG_OOB</constant></entry> <entry> - Receive out-of-band data. + Process out-of-band data. </entry> </row> <row> - <entry>MSG_PEEK</entry> + <entry><constant>MSG_PEEK</constant></entry> <entry> Receive data from the beginning of the receive queue without removing it from the queue. </entry> </row> <row> - <entry>MSG_WAITALL</entry> + <entry><constant>MSG_WAITALL</constant></entry> <entry> Block until at least <parameter>len</parameter> are received. However, if a signal is caught or the remote host disconnects, the @@ -113,7 +113,7 @@ </entry> </row> <row> - <entry>MSG_DONTWAIT</entry> + <entry><constant>MSG_DONTWAIT</constant></entry> <entry> With this flag set, the function returns even if it would normally have blocked. @@ -174,20 +174,20 @@ <?php error_reporting(E_ALL | E_STRICT); -$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); -socket_connect($socket, "127.0.0.1", 1223); +$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); +socket_bind($socket, '127.0.0.1', 1223); -$Ip = ""; -socket_recvfrom($socket, $buf, 12, 0, $Ip, $Port); +$from = ""; +$port = 0; +socket_recvfrom($socket, $buf, 12, 0, $from, $port); -echo "Received data: $buf"; +echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; ?> ]]> </programlisting> <para> - This example will initiate a TCP connection to 127.0.0.1 on port 1223 and - print at most 12 characters received from the remote host or block until - data is received. + This example will initiate an UDP socket on port 1223 of 127.0.0.1 and + print at most 12 characters received from a remote host. </para> </example> </para>