ConnectedUDPSocketNotify¶
Callbacks for a connected UDP socket. Implement this trait and pass it to
ConnectedUDPSocket to handle socket events.
on_bind_failure and on_connect_failure have no default implementation
because ignoring either failure silently is never correct.
Public Functions¶
on_connected¶
Called when the socket is bound and connected, ready for I/O.
Parameters¶
- sock: ConnectedUDPSocket ref
Returns¶
- None val
on_bind_failure¶
Called when the socket could not bind.
Parameters¶
- sock: ConnectedUDPSocket ref
Returns¶
- None val
on_connect_failure¶
Called when the socket bound but could not connect to the peer.
Parameters¶
- sock: ConnectedUDPSocket ref
Returns¶
- None val
on_received¶
Called each time a datagram arrives from the connected peer.
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.
Parameters¶
- sock: ConnectedUDPSocket ref
- data: Array[U8 val] iso
Returns¶
on_closed¶
Called when the socket is closed.
Parameters¶
- sock: ConnectedUDPSocket ref
Returns¶
- None val