php-doc-en/language/context/socket.xml

137 lines
3.5 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 1.2 Maintainer: pedram Status: ready -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="context.socket" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" role="noversion">
<refnamediv>
<refname>گزینه‌های متن Socket</refname>
<refpurpose>فهرست گزینه متن Socket</refpurpose>
</refnamediv>
<refsect1 role="description"><!-- {{{ -->
&reftitle.description;
<para>
گزینه‌های متن Socket برای تمام پوشاننده‌ٰهای سوکت قابل استفاده هستند مانند <literal>tcp</literal>٬
<literal>http</literal> و
<literal>ftp</literal>.
</para>
</refsect1><!-- }}} -->
<refsect1 role="options"><!-- {{{ -->
&reftitle.options;
<para>
<variablelist>
<varlistentry xml:id="context.socket.bindto">
<term><parameter>bindto</parameter></term>
<listitem>
<para>
برای تعیین آدرس IP (هر یک از IPv4 یا IPv6) و/یا شماره پورت مورد استفاده PHP برای شبکه. دستور آن
<literal>ip:port</literal> است.
تنظیم IP یا پورت <literal>0</literal> به سیستم امکان انتخاب
IP و/یا پورت را می‌دهد.
</para>
<note>
<para>
FTP با ساختن دو سوکت اتصال در طول عملیات معمول نمی‌تواند شماره
پورت را با این گزینه تعیین نماید.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1><!-- }}} -->
<refsect1 role="changelog"><!-- {{{ -->
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.1.0</entry>
<entry>
<literal>bindto</literal> اضافه شد.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1><!-- }}} -->
<refsect1 role="examples"><!-- {{{ -->
&reftitle.examples;
<para>
<example xml:id="context.socket.example-bindto"><!-- {{{ -->
<title>نمونه اصلی استفاده از <parameter>bindto</parameter></title>
<programlisting role="php">
<![CDATA[
<?php
// connect to the internet using the '192.168.0.100' IP
$opts = array(
'socket' => array(
'bindto' => '192.168.0.100:0',
),
);
// connect to the internet using the '192.168.0.100' IP and port '7000'
$opts = array(
'socket' => array(
'bindto' => '192.168.0.100:7000',
),
);
// connect to the internet using port '7000'
$opts = array(
'socket' => array(
'bindto' => '0:7000',
),
);
// create the context...
$context = stream_context_create($opts);
// ...and use it to fetch the data
echo file_get_contents('http://www.example.com', false, $context);
?>
]]>
</programlisting>
</example><!-- }}} -->
</para>
</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:"../../../../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
-->