| 1 | <?php |
||
| 10 | abstract class AbstractServer extends AbstractSocket { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * The server's name as `<address>:<port>`, |
||
| 14 | * or `<filepath>:0` for Unix sockets, |
||
| 15 | * or `?<id>` if a name can't be derived (e.g. the socket is closed). |
||
| 16 | * |
||
| 17 | * @see getSockName() |
||
| 18 | * |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | public function __toString () { |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Binds to an address and port, or file path (Unix) for the OS to create, so the server can listen. |
||
| 32 | * |
||
| 33 | * Unix sockets do not honor `SO_REUSEADDR`. |
||
| 34 | * It is your responsibility to remove unused socket files. |
||
| 35 | * |
||
| 36 | * @see https://php.net/socket_bind |
||
| 37 | * |
||
| 38 | * @param string $address |
||
| 39 | * @param int $port Zero for a random unused network port. Unix sockets ignore the port entirely. |
||
| 40 | * @return $this |
||
| 41 | * @throws SocketError |
||
| 42 | */ |
||
| 43 | public function bind (string $address, int $port = 0) { |
||
| 49 | |||
| 50 | } |
||
| 51 |