1 | <?php |
||
8 | class StreamServer extends AbstractServer { |
||
9 | |||
10 | /** |
||
11 | * `SOCK_STREAM` |
||
12 | * |
||
13 | * @return int |
||
14 | */ |
||
15 | final public static function getType (): int { |
||
18 | |||
19 | /** |
||
20 | * Accepts an incoming client connection. |
||
21 | * This will block unless the server was selected for reading. |
||
22 | * |
||
23 | * @see https://php.net/socket_accept |
||
24 | * |
||
25 | * @return StreamClient |
||
26 | * @throws SocketError |
||
27 | */ |
||
28 | public function accept (): StreamClient { |
||
34 | |||
35 | /** |
||
36 | * Enables incoming connections. |
||
37 | * |
||
38 | * Listening without binding first will cause the socket to bind to a random port on *all* network interfaces. |
||
39 | * |
||
40 | * @see https://php.net/socket_listen |
||
41 | * |
||
42 | * @see bind() |
||
43 | * |
||
44 | * @param int $backlog Connection queue size, or `0` to use the system's default. |
||
45 | * @return $this |
||
46 | * @throws SocketError |
||
47 | */ |
||
48 | public function listen (int $backlog = 0) { |
||
54 | |||
55 | /** |
||
56 | * Wraps an accepted connection. |
||
57 | * |
||
58 | * @param resource $resource The accepted connection. |
||
59 | * @return StreamClient |
||
60 | */ |
||
61 | protected function newClient ($resource): StreamClient { |
||
64 | |||
65 | } |
||
66 |