ResourceServerSocket
in package
implements
ServerSocket, ResourceStream
uses
ForbidCloning, ForbidSerialization
FinalYes
Table of Contents
Interfaces
Properties
- $acceptor : Suspension|null
- $address : SocketAddress
- $bindContext : BindContext
- $callbackId : string
- $cancel : callable(CancelledException): void
- $chunkSize : int
- $errorHandler : Closure
- $onClose : DeferredFuture
- $socket : resource|null
Methods
- __construct() : mixed
- __destruct() : mixed
- Automatically cancels the loop watcher.
- __serialize() : never
- __unserialize() : never
- accept() : ResourceSocket|null
- close() : void
- Closes the server and stops accepting connections. Any socket clients accepted will not be closed.
- getAddress() : SocketAddress
- getBindContext() : BindContext
- getResource() : resource|null
- Raw stream socket resource.
- isClosed() : bool
- Returns whether this resource has been closed.
- onClose() : void
- Registers a callback that is invoked when this resource is closed.
- reference() : void
- References the readability callback used for detecting new connection attempts in {@code accept()}.
- unreference() : void
- Unreferences the readability callback used for detecting new connection attempts in {@code accept()}.
- __clone() : mixed
- acceptSocketClient() : resource|false
- free() : void
Properties
$acceptor
private
Suspension|null
$acceptor
= null
$address read-only
private
SocketAddress
$address
$bindContext read-only
private
BindContext
$bindContext
$callbackId read-only
private
string
$callbackId
$cancel read-only
private
callable(CancelledException): void
$cancel
$chunkSize read-only
private
int
$chunkSize
= ResourceSocket::DEFAULT_CHUNK_SIZE
$errorHandler read-only
private
Closure
$errorHandler
$onClose read-only
private
DeferredFuture
$onClose
$socket
private
resource|null
$socket
Stream socket server resource.
Methods
__construct()
public
__construct(resource $socket, BindContext $bindContext[, positive-int $chunkSize = ResourceSocket::DEFAULT_CHUNK_SIZE ]) : mixed
Parameters
- $socket : resource
-
A bound socket server resource
- $bindContext : BindContext
- $chunkSize : positive-int = ResourceSocket::DEFAULT_CHUNK_SIZE
-
Chunk size for the input and output stream.
Tags
__destruct()
Automatically cancels the loop watcher.
public
__destruct() : mixed
__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
neveraccept()
public
accept([Cancellation|null $cancellation = null ]) : ResourceSocket|null
Parameters
- $cancellation : Cancellation|null = null
Tags
Return values
ResourceSocket|nullclose()
Closes the server and stops accepting connections. Any socket clients accepted will not be closed.
public
close() : void
getAddress()
public
getAddress() : SocketAddress
Return values
SocketAddressgetBindContext()
public
getBindContext() : BindContext
Return values
BindContextgetResource()
Raw stream socket resource.
public
getResource() : resource|null
Return values
resource|nullisClosed()
Returns whether this resource has been closed.
public
isClosed() : bool
Return values
bool —true if closed, otherwise false.
onClose()
Registers a callback that is invoked when this resource is closed.
public
onClose(Closure $onClose) : void
Parameters
- $onClose : Closure
reference()
References the readability callback used for detecting new connection attempts in {@code accept()}.
public
reference() : void
Tags
unreference()
Unreferences the readability callback used for detecting new connection attempts in {@code accept()}.
public
unreference() : void
Tags
__clone()
protected
final __clone() : mixed
acceptSocketClient()
private
acceptSocketClient() : resource|false
Return values
resource|falsefree()
private
free() : void