Corrected the table and removed unapplicable flags. Also added a better description.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@241450 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nick Berard 2007-08-17 15:17:30 +00:00
parent 4a8da15349
commit bd18bd44af
3 changed files with 50 additions and 44 deletions

View file

@ -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>

View file

@ -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
</entry>
</row>
<row>
<entry><constant>MSG_PEEK</constant></entry>
<entry>
Peek at incoming message
</entry>
</row>
<row>
<entry><constant>MSG_DONTROUTE</constant></entry>
<entry>
Bypass routing, use direct interface
Send OOB (out-of-band) data.
</entry>
</row>
<row>
<entry><constant>MSG_EOR</constant></entry>
<entry>
Data completes record
Indicate a record mark. The sent data completes the record.
</entry>
</row>
<row>
<entry><constant>MSG_EOF</constant></entry>
<entry>
Data completes transaction
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_DONTROUTE</constant></entry>
<entry>
Bypass routing, use direct interface.
</entry>
</row>
</tbody>

View file

@ -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>