Documentation

UdpSocket extends Closable
in

Table of Contents

Methods

close()  : void
Closes the resource, marking it as unusable.
getAddress()  : InternetAddress
isClosed()  : bool
Returns whether this resource has been closed.
onClose()  : void
Registers a callback that is invoked when this resource is closed.
receive()  : InternetAddress, string}|null
send()  : void

Methods

close()

Closes the resource, marking it as unusable.

public close() : void

Whether pending operations are aborted or not is implementation dependent.

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(callable(): void $onClose) : void
Parameters
$onClose : callable(): void

receive()

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

Read at most $limit bytes from the datagram socket. null uses an implementation defined limit.

Tags
throws
PendingReceiveError

If a reception request is already pending.

Return values
InternetAddress, string}|null

Returns null if the socket is closed.


        
On this page

Search results