function.socket-send.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 178 行
HTML
178 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Sends data to a connected socket</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.socket-select.html">socket_select</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.socket-sendto.html">socket_sendto</a></div> <div class="up"><a href="ref.sockets.html">Socket Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.socket-send" class="refentry"> <div class="refnamediv"> <h1 class="refname">socket_send</h1> <p class="verinfo">(PHP 4 >= 4.0.7, PHP 5)</p><p class="refpurpose"><span class="refname">socket_send</span> — <span class="dc-title">Sends data to a connected socket</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>socket_send</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$socket</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$buf</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$len</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$flags</tt></span> )</div> <p class="para rdfs-comment"> The function <b>socket_send()</b> sends <i><tt class="parameter">len</tt></i> bytes to the socket <i><tt class="parameter">socket</tt></i> from <i><tt class="parameter">buf</tt></i>. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">socket</tt></i></span> <dd> <p class="para"> A valid socket resource created with <a href="function.socket-create.html" class="function">socket_create()</a> or <a href="function.socket-accept.html" class="function">socket_accept()</a>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">buf</tt></i></span> <dd> <p class="para"> A buffer containing the data that will be sent to the remote host. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">len</tt></i></span> <dd> <p class="para"> The number of bytes that will be sent to the remote host from <i><tt class="parameter">buf</tt></i>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">flags</tt></i></span> <dd> <p class="para"> The value of <i><tt class="parameter">flags</tt></i> can be any combination of the following flags, joined with the binary OR (<i>|</i>) operator. <table border="5"> <caption><b>Possible values for <i><tt class="parameter">flags</tt></i></b></caption> <colgroup> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left"><b><tt>MSG_OOB</tt></b></td> <td colspan="1" rowspan="1" align="left"> Send OOB (out-of-band) data. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left"><b><tt>MSG_EOR</tt></b></td> <td colspan="1" rowspan="1" align="left"> Indicate a record mark. The sent data completes the record. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left"><b><tt>MSG_EOF</tt></b></td> <td colspan="1" rowspan="1" align="left"> Close the sender side of the socket and include an appropriate notification of this at the end of the sent data. The sent data completes the transaction. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left"><b><tt>MSG_DONTROUTE</tt></b></td> <td colspan="1" rowspan="1" align="left"> Bypass routing, use direct interface. </td> </tr> </tbody> </colgroup> </table> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.socket-sendto.html" class="function" rel="rdfs-seeAlso">socket_sendto()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.socket-select.html">socket_select</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.socket-sendto.html">socket_sendto</a></div> <div class="up"><a href="ref.sockets.html">Socket Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?