<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.stream-socket-sendto" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>stream_socket_sendto</refname>
  <refpurpose>Sends a message to a socket, whether it is connected or not </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>int</type><type>false</type></type><methodname>stream_socket_sendto</methodname>
   <methodparam><type>resource</type><parameter>socket</parameter></methodparam>
   <methodparam><type>string</type><parameter>data</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>address</parameter><initializer>""</initializer></methodparam>
  </methodsynopsis>
  <para>
   Sends the specified <parameter>data</parameter> through the
   <parameter>socket</parameter>.  
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>socket</parameter></term>
     <listitem>
      <para>
       The socket to send <parameter>data</parameter> to.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>data</parameter></term>
     <listitem>
      <para>
       The data to be sent.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>flags</parameter></term>
     <listitem>
      <para>
       The value of <parameter>flags</parameter> can be any combination
       of the following:
       <table>
        <title>possible values for <parameter>flags</parameter></title>
        <tgroup cols="2">
         <tbody>
          <row>
           <entry><constant>STREAM_OOB</constant></entry>
           <entry>
            Process OOB (out-of-band) data.
           </entry>
          </row>
         </tbody>
        </tgroup>
       </table>
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>address</parameter></term>
     <listitem>
      <para>
       The address specified when the socket stream was created will be used
       unless an alternate address is specified in <parameter>address</parameter>.
      </para>
      <para>
       If specified, it must be in dotted quad (or [ipv6]) format.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns a result code, as an integer,&return.falseforfailure;.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>stream_socket_sendto</function> Example</title>
    <programlisting role="php">
<![CDATA[
<?php
/* Open a socket to port 1234 on localhost */
$socket = stream_socket_client('tcp://127.0.0.1:1234');

/* Send ordinary data via ordinary channels. */
fwrite($socket, "Normal data transmit.");

/* Send more data out of band. */
stream_socket_sendto($socket, "Out of Band data.", STREAM_OOB);

/* Close it up */
fclose($socket);
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>stream_socket_recvfrom</function></member>
   <member><function>stream_socket_client</function></member>
   <member><function>stream_socket_server</function></member>
  </simplelist>
 </refsect1>
</refentry>
<!-- 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:"~/.phpdoc/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
-->
