<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >socket_get_option</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Socket Functions" HREF="ref.sockets.html"><LINK REL="PREVIOUS" TITLE="socket_create" HREF="function.socket-create.html"><LINK REL="NEXT" TITLE="socket_getpeername" HREF="function.socket-getpeername.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.socket-create.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.socket-getpeername.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.socket-get-option" ></A >socket_get_option</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN213133" ></A ><P > (PHP 4 >= 4.3.0, PHP 5)</P >socket_get_option -- Gets socket options for the socket </DIV ><DIV CLASS="refsect1" ><A NAME="AEN213136" ></A ><H2 >Description</H2 >mixed <B CLASS="methodname" >socket_get_option</B > ( resource socket, int level, int optname )<BR ></BR ><P > The <B CLASS="function" >socket_get_option()</B > function retrieves the value for the option specified by the <CODE CLASS="parameter" >optname</CODE > parameter for the socket specified by the <CODE CLASS="parameter" >socket</CODE > parameter. <B CLASS="function" >socket_get_option()</B > will return <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > The <CODE CLASS="parameter" >level</CODE > parameter specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a <CODE CLASS="parameter" >level</CODE > 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 <A HREF="function.getprotobyname.html" ><B CLASS="function" >getprotobyname()</B ></A > function. </P ><DIV CLASS="table" ><A NAME="AEN213160" ></A ><P ><B >表 1. Available Socket Options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Option</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >SO_DEBUG</TD ><TD > Reports whether debugging information is being recorded. </TD ></TR ><TR ><TD >SO_ACCEPTCONN</TD ><TD > Reports whether socket listening is enabled. </TD ></TR ><TR ><TD >SO_BROADCAST</TD ><TD > Reports whether transmission of broadcast messages is supported. </TD ></TR ><TR ><TD >SO_REUSEADDR</TD ><TD > Reports whether local addresses can be reused. </TD ></TR ><TR ><TD >SO_KEEPALIVE</TD ><TD > 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. </TD ></TR ><TR ><TD >SO_LINGER</TD ><TD > Reports whether the <CODE CLASS="parameter" >socket</CODE > lingers on <A HREF="function.socket-close.html" ><B CLASS="function" >socket_close()</B ></A > if data is present. </TD ></TR ><TR ><TD >SO_OOBINLINE</TD ><TD > Reports whether the <CODE CLASS="parameter" >socket</CODE > leaves out-of-band data inline. </TD ></TR ><TR ><TD >SO_SNDBUF</TD ><TD > Reports send buffer size information. </TD ></TR ><TR ><TD >SO_RCVBUF</TD ><TD > Reports recieve buffer size information. </TD ></TR ><TR ><TD >SO_ERROR</TD ><TD > Reports information about error status and clears it. </TD ></TR ><TR ><TD >SO_TYPE</TD ><TD > Reports the <CODE CLASS="parameter" >socket</CODE > type. </TD ></TR ><TR ><TD >SO_DONTROUTE</TD ><TD > Reports whether outgoing messages bypass the standard routing facilities. </TD ></TR ><TR ><TD >SO_RCVLOWAT</TD ><TD > Reports the minimum number of bytes to process for <CODE CLASS="parameter" >socket</CODE > input operations. ( Defaults to 1 ) </TD ></TR ><TR ><TD >SO_RCVTIMEO</TD ><TD > Reports the timeout value for input operations. </TD ></TR ><TR ><TD >SO_SNDLOWAT</TD ><TD > Reports the minimum number of bytes to process for <CODE CLASS="parameter" >socket</CODE > output operations. </TD ></TR ><TR ><TD >SO_SNDTIMEO</TD ><TD > Reports the timeout value specifying the amount of time that an output function blocks because flow control prevents data from being sent. </TD ></TR ></TBODY ></TABLE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > This function used to be called <TT CLASS="literal" >socket_getopt()</TT > prior to PHP 4.3.0 </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.socket-create.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.socket-getpeername.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >socket_create</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sockets.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >socket_getpeername</TD ></TR ></TABLE ></DIV ></BODY ></HTML >