UDPSocketNotify¶
Callbacks for a UDP socket. Implement this trait and pass it to UDPSocket
to handle socket events.
on_bind_failure has no default implementation because ignoring a bind
failure silently is never correct.
Public Functions¶
on_bound¶
Called when the socket is bound and ready for I/O.
Parameters¶
- sock: UDPSocket ref
Returns¶
- None val
on_bind_failure¶
Called when the socket could not bind.
Parameters¶
- sock: UDPSocket ref
Returns¶
- None val
on_received¶
Called each time a datagram arrives.
Return KeepReading to let the read loop take the next datagram, or
YieldReading to stop after this one and give other actors a turn.
The default returns KeepReading. Send-only sockets use this default
and never override it. Datagrams that arrive on a socket that does not
override this method are silently discarded.
fun ref on_received(
sock: UDPSocket ref,
data: Array[U8 val] iso,
from: NetAddress val)
: ReadAction
Parameters¶
- sock: UDPSocket ref
- data: Array[U8 val] iso
- from: NetAddress val
Returns¶
on_closed¶
Called when the socket is closed.
Parameters¶
- sock: UDPSocket ref
Returns¶
- None val