Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 1219

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Swoole\Server class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swoole-serialize.unpack.html">Swoole\Serialize::unpack</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swoole-server.addlistener.html">Swoole\Server::addlistener</a></div>
 <div class="up"><a href="book.swoole.html">Swoole</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.swoole-server" class="reference">

 <h1 class="title">The Swoole\Server class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PECL swoole &gt;= 1.9.0)</p>


  <div class="section" id="swoole-server.intro">
   <h2 class="title">Introduction</h2>
   <p class="para">

   </p>
  </div>


  <div class="section" id="swoole-server.synopsis">
   <h2 class="title">Class synopsis</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">Swoole\Server</strong>
     </span>
     {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.addlistener.html" class="methodname">addlistener</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   , <span class="methodparam"><span class="type">integer</span> <code class="parameter">$port</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$socket_type</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.addprocess.html" class="methodname">addProcess</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.swoole-process.html" class="type swoole_process">swoole_process</a></span> <code class="parameter">$process</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">ReturnType</span> <span class="methodname"><a href="swoole-server.after.html" class="methodname">after</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$after_time_ms</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$param</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.bind.html" class="methodname">bind</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   , <span class="methodparam"><span class="type">integer</span> <code class="parameter">$uid</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.cleartimer.html" class="methodname">clearTimer</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$timer_id</code></span>
    )</div>
<div class="methodsynopsis dc-description">
   <span class="type">void</span> <span class="methodname"><strong>swoole_timer_clear</strong></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$timer_id</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.close.html" class="methodname">close</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   [, <span class="methodparam"><span class="type">boolean</span> <code class="parameter">$reset</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.confirm.html" class="methodname">confirm</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="swoole-server.connection-info.html" class="methodname">connection_info</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$reactor_id</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="swoole-server.connection-list.html" class="methodname">connection_list</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$start_fd</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$pagesize</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.defer.html" class="methodname">defer</a></span>
    ( <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server-port.destruct.html" class="methodname">Swoole\Server\Port::__destruct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">ReturnType</span> <span class="methodname"><a href="swoole-server-port.on.html" class="methodname">Swoole\Server\Port::on</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$event_name</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server-port.set.html" class="methodname">Swoole\Server\Port::set</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$settings</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.exist.html" class="methodname">exist</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.finish.html" class="methodname">finish</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">ReturnType</span> <span class="methodname"><a href="swoole-server.getclientinfo.html" class="methodname">getClientInfo</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$reactor_id</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="swoole-server.getclientlist.html" class="methodname">getClientList</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$start_fd</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$pagesize</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">integer</span> <span class="methodname"><a href="swoole-server.getlasterror.html" class="methodname">getLastError</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="swoole-server.heartbeat.html" class="methodname">heartbeat</a></span>
    ( <span class="methodparam"><span class="type">boolean</span> <code class="parameter">$if_close_connection</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.listen.html" class="methodname">listen</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   , <span class="methodparam"><span class="type">integer</span> <code class="parameter">$port</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$socket_type</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.on.html" class="methodname">on</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$event_name</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.pause.html" class="methodname">pause</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.protect.html" class="methodname">protect</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   [, <span class="methodparam"><span class="type">boolean</span> <code class="parameter">$is_protected</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.reload.html" class="methodname">reload</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.resume.html" class="methodname">resume</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.send.html" class="methodname">send</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$reactor_id</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.sendfile.html" class="methodname">sendfile</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$offset</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.sendmessage.html" class="methodname">sendMessage</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$worker_id</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.sendto.html" class="methodname">sendto</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$ip</code></span>
   , <span class="methodparam"><span class="type">integer</span> <code class="parameter">$port</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$server_socket</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.sendwait.html" class="methodname">sendwait</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$fd</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">ReturnType</span> <span class="methodname"><a href="swoole-server.set.html" class="methodname">set</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$settings</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.shutdown.html" class="methodname">shutdown</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.start.html" class="methodname">start</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="swoole-server.stats.html" class="methodname">stats</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">boolean</span> <span class="methodname"><a href="swoole-server.stop.html" class="methodname">stop</a></span>
    ([ <span class="methodparam"><span class="type">integer</span> <code class="parameter">$worker_id</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="swoole-server.task.html" class="methodname">task</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$dst_worker_id</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.taskwait.html" class="methodname">taskwait</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$timeout</code></span>
   [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$worker_id</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.taskwaitmulti.html" class="methodname">taskWaitMulti</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$tasks</code></span>
   [, <span class="methodparam"><span class="type">double</span> <code class="parameter">$timeout_ms</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-server.tick.html" class="methodname">tick</a></span>
    ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$interval_ms</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   )</div>

   }</div>


  </div>

 </div>

 

































































































































































































































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="swoole-server.addlistener.html">Swoole\Server::addlistener</a> — Add a new listener to the server.</li><li><a href="swoole-server.addprocess.html">Swoole\Server::addProcess</a> — Add a user defined swoole_process to the server.</li><li><a href="swoole-server.after.html">Swoole\Server::after</a> — Trigger a callback function after a period of time.</li><li><a href="swoole-server.bind.html">Swoole\Server::bind</a> — Bind the connection to a user defined user ID.</li><li><a href="swoole-server.cleartimer.html">Swoole\Server::clearTimer</a> — Stop and destory a timer.</li><li><a href="swoole-server.close.html">Swoole\Server::close</a> — Close a connection to the client.</li><li><a href="swoole-server.confirm.html">Swoole\Server::confirm</a> — Check status of the connection.</li><li><a href="swoole-server.connection-info.html">Swoole\Server::connection_info</a> — Get the connection info by file description.</li><li><a href="swoole-server.connection-list.html">Swoole\Server::connection_list</a> — Get all of the established connections.</li><li><a href="swoole-server.construct.html">Swoole\Server::__construct</a> — Construct a Swoole server.</li><li><a href="swoole-server.defer.html">Swoole\Server::defer</a> — Delay execution of the callback function at the end of current EventLoop.</li><li><a href="swoole-server-port.construct.html">Swoole\Server\Port::__construct</a> — Construct a server port</li><li><a href="swoole-server-port.destruct.html">Swoole\Server\Port::__destruct</a> — Destory server port</li><li><a href="swoole-server-port.on.html">Swoole\Server\Port::on</a> — Register callback functions by event.</li><li><a href="swoole-server-port.set.html">Swoole\Server\Port::set</a> — Set protocol of the server port.</li><li><a href="swoole-server.exist.html">Swoole\Server::exist</a> — Check if the connection is existed.</li><li><a href="swoole-server.finish.html">Swoole\Server::finish</a> — Used in task process for sending result to the worker process when the task is finished.</li><li><a href="swoole-server.getclientinfo.html">Swoole\Server::getClientInfo</a> — Get the connection info by file description.</li><li><a href="swoole-server.getclientlist.html">Swoole\Server::getClientList</a> — Get all of the established connections.</li><li><a href="swoole-server.getlasterror.html">Swoole\Server::getLastError</a> — Get the error code of the most recent error.</li><li><a href="swoole-server.heartbeat.html">Swoole\Server::heartbeat</a> — Check all the connections on the server.</li><li><a href="swoole-server.listen.html">Swoole\Server::listen</a> — Listen on the given IP and port, socket type.</li><li><a href="swoole-server.on.html">Swoole\Server::on</a> — Register a callback function by event name.</li><li><a href="swoole-server.pause.html">Swoole\Server::pause</a> — Stop receiving data from the connection.</li><li><a href="swoole-server.protect.html">Swoole\Server::protect</a> — Set the connection to be protected mode.</li><li><a href="swoole-server.reload.html">Swoole\Server::reload</a> — Restart all the worker process.</li><li><a href="swoole-server.resume.html">Swoole\Server::resume</a> — Start receving data from the connection.</li><li><a href="swoole-server.send.html">Swoole\Server::send</a> — Send data to the client.</li><li><a href="swoole-server.sendfile.html">Swoole\Server::sendfile</a> — Send file to the connection.</li><li><a href="swoole-server.sendmessage.html">Swoole\Server::sendMessage</a> — Send message to worker processes by ID.</li><li><a href="swoole-server.sendto.html">Swoole\Server::sendto</a> — Send data to the remote UDP address.</li><li><a href="swoole-server.sendwait.html">Swoole\Server::sendwait</a> — Send data to the remote socket in the blocking way.</li><li><a href="swoole-server.set.html">Swoole\Server::set</a> — Set the runtime settings of the swoole server.</li><li><a href="swoole-server.shutdown.html">Swoole\Server::shutdown</a> — Shutdown the master server process, this function can be called in worker processes.</li><li><a href="swoole-server.start.html">Swoole\Server::start</a> — Start the Swoole server.</li><li><a href="swoole-server.stats.html">Swoole\Server::stats</a> — Get the stats of the Swoole server.</li><li><a href="swoole-server.stop.html">Swoole\Server::stop</a> — Stop the Swoole server.</li><li><a href="swoole-server.task.html">Swoole\Server::task</a> — Send data to the task worker processes.</li><li><a href="swoole-server.taskwait.html">Swoole\Server::taskwait</a> — Send data to the task worker processes in blocking way.</li><li><a href="swoole-server.taskwaitmulti.html">Swoole\Server::taskWaitMulti</a> — Execute multiple tasks concurrently.</li><li><a href="swoole-server.tick.html">Swoole\Server::tick</a> — Repeats a given function at every given time-interval.</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swoole-serialize.unpack.html">Swoole\Serialize::unpack</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swoole-server.addlistener.html">Swoole\Server::addlistener</a></div>
 <div class="up"><a href="book.swoole.html">Swoole</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>