Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 12370

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>php_stream_sock_open_host</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Streams Socket API Reference"
HREF="streams.socket-api.html"><LINK
REL="PREVIOUS"
TITLE="php_stream_sock_open_from_socket"
HREF="streams.php-stream-sock-open-from-socket.html"><LINK
REL="NEXT"
TITLE="php_stream_sock_open_unix"
HREF="streams.php-stream-sock-open-unix.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="streams.php-stream-sock-open-from-socket.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="streams.php-stream-sock-open-unix.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="streams.php-stream-sock-open-host"
></A
>php_stream_sock_open_host</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN253420"
></A
>php_stream_sock_open_host&nbsp;--&nbsp;Open a connection to a host and return a stream</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN253423"
></A
><H2
>Description</H2
>php_stream * <B
CLASS="methodname"
>php_stream_sock_open_host</B
> ( const char * host, unsigned short port, int socktype, struct timeval * timeout, int persistent )<BR
></BR
><P
>&#13;     <B
CLASS="function"
>php_stream_sock_open_host()</B
> establishes a connect to the specified
     <CODE
CLASS="parameter"
>host</CODE
> and <CODE
CLASS="parameter"
>port</CODE
>. <CODE
CLASS="parameter"
>socktype</CODE
>
     specifies the connection semantics that should apply to the connection. Values for
     <CODE
CLASS="parameter"
>socktype</CODE
> are system dependent, but will usually include (at a minimum)
     <TT
CLASS="constant"
><B
>SOCK_STREAM</B
></TT
> for sequenced, reliable, two-way connection based streams (TCP),
     or <TT
CLASS="constant"
><B
>SOCK_DGRAM</B
></TT
> for connectionless, unreliable messages of a fixed maximum
     length (UDP).
    </P
><P
>&#13;     <CODE
CLASS="parameter"
>persistent</CODE
> is a flag the controls whether the stream is opened as a persistent
     stream. Generally speaking, this parameter will usually be 0.
    </P
><P
>&#13;     If not NULL, <CODE
CLASS="parameter"
>timeout</CODE
> specifies a maximum time to allow for the connection to be made.
     If the connection attempt takes longer than the timeout value, the connection attempt is aborted and
     NULL is returned to indicate that the stream could not be opened.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
      The timeout value does not include the time taken to perform a DNS lookup. The reason for this is
      because there is no portable way to implement a non-blocking DNS lookup.
     </P
><P
>&#13;      The timeout only applies to the connection phase; if you need to set timeouts for subsequent read
      or write operations, you should use <B
CLASS="function"
>php_stream_sock_set_timeout()</B
> to configure
      the timeout duration for your stream once it has been opened.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     The streams API places no restrictions on the values you use for <CODE
CLASS="parameter"
>socktype</CODE
>,
     but encourages you to consider the portability of values you choose before you release your
     extension.
    </P
></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="streams.php-stream-sock-open-from-socket.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="streams.php-stream-sock-open-unix.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>php_stream_sock_open_from_socket</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="streams.socket-api.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>php_stream_sock_open_unix</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>