Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP Manual > socket_get_option - Gets socket options for the socket





ลองใช้ค้นหาข้อมูล


   
Bookmark.

socket_get_option

(PHP 4 >= 4.3.0, PHP 5)

socket_get_optionGets socket options for the socket

Description

mixed socket_get_option ( resource $socket , int $level , int $optname )

The socket_get_option() function retrieves the value for the option specified by the optname parameter for the specified socket .

Parameters

socket

A valid socket resource created with socket_create() or socket_accept().

level

The level parameter specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a level parameter of SOL_SOCKET would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the getprotobyname() function.

optname
Available Socket Options
Option Description Type
SO_DEBUG Reports whether debugging information is being recorded. int
SO_BROADCAST Reports whether transmission of broadcast messages is supported. int
SO_REUSEADDR Reports whether local addresses can be reused. int
SO_KEEPALIVE Reports whether connections are kept active with periodic transmission of messages. If the connected socket fails to respond to these messages, the connection is broken and processes writing to that socket are notified with a SIGPIPE signal. int
SO_LINGER

Reports whether the socket lingers on socket_close() if data is present. By default, when the socket is closed, it attempts to send all unsent data. In the case of a connection-oriented socket, socket_close() will wait for its peer to acknowledge the data.

If l_onoff is non-zero and l_linger is zero, all the unsent data will be discarded and RST (reset) is sent to the peer in the case of a connection-oriented socket.

On the other hand, if l_onoff is non-zero and l_linger is non-zero, socket_close() will block until all the data is sent or the time specified in l_linger elapses. If the socket is non-blocking, socket_close() will fail and return an error.

array. The array will contain two keys: l_onoff and l_linger.
SO_OOBINLINE Reports whether the socket leaves out-of-band data inline. int
SO_SNDBUF Reports the size of the send buffer. int
SO_RCVBUF Reports the size of the receive buffer. int
SO_ERROR Reports information about error status and clears it. int (cannot be set by socket_set_option())
SO_TYPE Reports the socket type (e.g. SOCK_STREAM). int (cannot be set by socket_set_option())
SO_DONTROUTE Reports whether outgoing messages bypass the standard routing facilities. int
SO_RCVLOWAT Reports the minimum number of bytes to process for socket input operations. int
SO_RCVTIMEO Reports the timeout value for input operations. array. The array will contain two keys: sec which is the seconds part on the timeout value and usec which is the microsecond part of the timeout value.
SO_SNDTIMEO Reports the timeout value specifying the amount of time that an output function blocks because flow control prevents data from being sent. array. The array will contain two keys: sec which is the seconds part on the timeout value and usec which is the microsecond part of the timeout value.
SO_SNDLOWAT Reports the minimum number of bytes to process for socket output operations. int

Return Values

Returns the value of the given option, or FALSE on errors.

Examples

Example #1 socket_set_option() example

<?php
$socket 
socket_create_listen(1223);

$linger = array('l_linger' => 1'l_onoff' => 1);
socket_set_option($socketSOL_SOCKETSO_LINGER$linger);

var_dump(socket_get_option($socketSOL_SOCKETSO_REUSEADDR));
?>

ChangeLog

Version Description
4.3.0 The name of this function was changed. It used to be called socket_getopt().



ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่