ConnectedUDPBackend¶
The operations a connected UDP socket needs from the runtime. Overlaps with
UDPBackend for bind and receive; adds connect and send for connected-mode
I/O. ConnectedUDPRuntimeBackend is the production implementation. Test
code can substitute a fake that implements only this trait.
Constructors¶
create¶
Returns¶
- ConnectedUDPBackend ref^
Public Functions¶
bind¶
Bind a UDP socket to host:port and subscribe the_actor for
readiness events. Returns the ASIO event, or a null event on failure.
fun ref bind(
the_actor: AsioEventNotify tag,
host: String val,
port: String val,
ip_version: IPVersion = DualStack)
: AsioEventID
Parameters¶
- the_actor: AsioEventNotify tag
- host: String val
- port: String val
- ip_version: IPVersion = DualStack
Returns¶
connect¶
Set the default peer address on an already-bound UDP socket. Returns true on success.
fun ref connect(
fd: U32 val,
host: String val,
port: String val,
ip_version: IPVersion = DualStack)
: Bool val
Parameters¶
Returns¶
- Bool val
close¶
Close the socket.
Parameters¶
- fd: U32 val
Returns¶
- None val
recvfrom¶
Receive one datagram into buffer. Returns the tri-state socket result,
the number of bytes received, and the sender address.
fun ref recvfrom(
event: AsioEventID,
buffer: Pointer[U8 val] tag,
size: USize val)
: (SocketResult , USize val , NetAddress iso^)
Parameters¶
- event: AsioEventID
- buffer: Pointer[U8 val] tag
- size: USize val
Returns¶
- (SocketResult , USize val , NetAddress iso^)
send¶
Send one datagram to the connected peer. Returns SocketResultOk on
success, SocketResultRetry when the OS buffer is full, or
SocketResultError on failure.
Parameters¶
Returns¶
sockname¶
Fill ip with the local address of fd. Returns true on success.
Parameters¶
- fd: U32 val
- ip: NetAddress tag
Returns¶
- Bool val
peername¶
Fill ip with the remote peer address of fd. Returns true on success.
Parameters¶
- fd: U32 val
- ip: NetAddress tag
Returns¶
- Bool val