downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

گزینه‌های متن HTTP> <گزینه و پارمترهای متن
[edit] Last updated: Fri, 24 Jun 2011

view this page in

گزینه‌های متن Socket

گزینه‌های متن Socketفهرست گزینه متن Socket

Description

گزینه‌های متن Socket برای تمام پوشاننده‌ٰهای سوکت قابل استفاده هستند مانند tcp٬ http و ftp.

Options

bindto

برای تعیین آدرس IP (هر یک از IPv4 یا IPv6) و/یا شماره پورت مورد استفاده PHP برای شبکه. دستور آن ip:port است. تنظیم IP یا پورت 0 به سیستم امکان انتخاب IP و/یا پورت را می‌دهد.

Note:

FTP با ساختن دو سوکت اتصال در طول عملیات معمول نمی‌تواند شماره پورت را با این گزینه تعیین نماید.

backlog

برای محدود نمودن تعداد اتصال‌های مهم در صف گوش کردن سوکت به کار می‌رود.

Note:

تنها برای stream_socket_server() قابل استفاده است.

Changelog

Version Description
5.1.0 bindto اضافه شد.
5.3.3 backlog اضافه شد.

Examples

Example #1 نمونه اصلی استفاده از bindto

<?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);

?>



add a note add a note User Contributed Notes گزینه‌های متن Socket - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites