Documentation

ResourceUdpSocket
in package
implements UdpSocket, ResourceStream uses ForbidCloning, ForbidSerialization

FinalYes

Table of Contents

Interfaces

UdpSocket
ResourceStream

Constants

DEFAULT_LIMIT  = 65507

Properties

$address  : InternetAddress
$callbackId  : string
$cancel  : callable(CancelledException): void
$defaultLimit  : int
$limit  : int
$onClose  : DeferredFuture
$reader  : Suspension|null
$socket  : resource|null

Methods

__construct()  : mixed
__destruct()  : mixed
Automatically cancels the loop watcher.
__serialize()  : never
__unserialize()  : never
close()  : void
Closes the datagram socket and stops receiving data. A pending {@code receive()} will return {@code null}.
getAddress()  : InternetAddress
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.
receive()  : null|InternetAddress, string}
reference()  : void
References the event loop callback used for being notified about available packets.
send()  : void
setLimit()  : void
unreference()  : void
Unreferences the event loop callback used for being notified about available packets.
__clone()  : mixed
free()  : void

Constants

Properties

Methods

__construct()

public __construct(resource $socket[, positive-int $limit = self::DEFAULT_LIMIT ]) : mixed
Parameters
$socket : resource

A bound udp socket resource.

$limit : positive-int = self::DEFAULT_LIMIT

Maximum size for received messages.

Tags
throws
Error

If a stream resource is not given for $socket.

__destruct()

Automatically cancels the loop watcher.

public __destruct() : mixed

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : never
Parameters
$data : array<string|int, mixed>
Return values
never

close()

Closes the datagram socket and stops receiving data. A pending {@code receive()} will return {@code null}.

public close() : void

getResource()

Raw stream socket resource.

public getResource() : resource|null
Return values
resource|null

isClosed()

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

receive()

public receive([Cancellation|null $cancellation = null ][, positive-int|null $limit = null ]) : null|InternetAddress, string}
Parameters
$cancellation : Cancellation|null = null
$limit : positive-int|null = null

If null, the default chunk size is used.

Return values
null|InternetAddress, string}

setLimit()

public setLimit(positive-int $limit) : void
Parameters
$limit : positive-int

The new default maximum packet size to receive.


        
On this page

Search results