1
0
mirror of https://github.com/php/doc-tr.git synced 2026-03-24 07:12:18 +01:00
Files
archived-doc-tr/reference/sockets/functions/socket-bind.xml
2022-11-17 16:43:57 +03:00

188 lines
5.2 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 14dc7c47365f2b71f6c907a5ba5bccf42534d5a9 Maintainer: nilgun Status: ready -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-bind">
<refnamediv>
<refname>socket_bind</refname>
<refpurpose>Soketi bir isimle ilişkilendirir</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>socket_bind</methodname>
<methodparam><type>Socket</type><parameter>soket</parameter></methodparam>
<methodparam><type>string</type><parameter>adres</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
Belirtilen <classname>Socket</classname> nesnesini
<parameter>adres</parameter>'teki bir isimle ilişkilendirir. Bu işlem,
<function>socket_connect</function> veya
<function>socket_listen</function> işlevlerini kullanarak bir bağlantı
oluşturulmadan önce yapılmalıdır.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>soket</parameter></term>
<listitem>
<para>
<function>socket_create</function> ile oluşturulmuş geçerli bir
<classname>Socket</classname> nesnesi.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>adres</parameter></term>
<listitem>
<para>
Soket, <constant>AF_INET</constant> türündeyse noktalı dördül
gösterimle (<literal>127.0.0.1</literal> gibi) geçerli bir IPv4
adresi, <constant>AF_INET6</constant> türündeyse ve IPv6 desteği varsa
geçerli bir IPv6 adresi (<literal>::1</literal> gibi) olmalıdır.
</para>
<para>
Soket, <constant>AF_UNIX</constant> türündeyse Unix ailesinden bir
soketin dosya yolu (<literal>/var/run/daemon.sock</literal> gibi)
olmalıdır.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter> (seçimlik)</term>
<listitem>
<para>
Bu bağımsız değişken sadece ve zorunlu olarak bir
<constant>AF_INET</constant> veya <constant>AF_INET6</constant> soketle
ilişkilendirme sırasında gerekir ve bağlantının yapılacağı uzak konak
üzerinde dinlenen bir portu belirtir.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
<para>
Hata kodu <function>socket_last_error</function> işlevi ile
alınabilir. Bu hata kodunu <function>socket_strerror</function> işlevine
aktararak hatayııklayan dizgeyi alabilirsiniz.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&sockets.changelog.socket-param;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>- Kaynak adresini belirtmek için
<function>socket_bind</function> kullanımı</title>
<programlisting role="php">
<![CDATA[
<?php
// Yeni bir soket oluştur
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// IP adreslerini makine sahibine göre tanımla
$sourceips['kevin'] = '127.0.0.1';
$sourceips['madcoder'] = '127.0.0.2';
// Soketi kaynak adresiyle ilişkilendir
socket_bind($sock, $sourceips['madcoder']);
// Hedef adrese bağlan
socket_connect($sock, '127.0.0.1', 80);
// Veriyi gönder
$request = 'GET / HTTP/1.1' . "\r\n" .
'Host: example.com' . "\r\n\r\n";
socket_write($sock, $request);
// Soketi kapat
socket_close($sock);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
Bu işlev <function>socket_connect</function> işlevinden önce
çağrılmalıdır.
</para>
</note>
<note><title>Windows 9x/ME uyumluluk bilgisi:</title>
<para>
Soketi makinenize ait olmayan bir adresle ilişkilendirmeye çalışırsanız
<function>socket_last_error</function> işlevi geçersiz bir hata kodu
döndürebilir.
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>socket_connect</function></member>
<member><function>socket_listen</function></member>
<member><function>socket_create</function></member>
<member><function>socket_last_error</function></member>
<member><function>socket_strerror</function></member>
</simplelist>
</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:"~/.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
-->