Swoole Server bind

bool Swoole\Server::bind ( int $fd , int $uid )

Alias: Swoole\Server->bind( int $fd , int $uid )

<?php
bool Swoole\Server->bind(int $fd, int $uid)

Bind the fd with system user UID.

The dispatch of different socket connection to the swoole server is influenced by the configuration of dispatch_mode

In the default dispatch_mode which is 2, the socket connection may be dispatched to different worker process after reconnetion. You can set the configuration of dispatch_mode to 5 and call Swoole\Server->bind to bind a uid number to socket connection. And then the same uid socket connection will be dispatched to the same worker process.

Parameter

  • $fd the id number of client
  • $uid the uid number binded for the client

Return

The result of binding

Example