Module net/udp
net/udp
Async UDP networking — connectionless datagram sockets.
Types
UdpSocket
object
UdpSocket
A UDP socket for sending and receiving datagrams.
Fields
| Name | Type | Description |
|---|---|---|
_fd | i32 | |
_local_addr | SocketAddr | |
_is_closed | bool |
Trait Implementations
impl(UdpSocket, ...)
bind : (UdpSocket) fn(addr : SocketAddr, io : Io) -> Impl(Future(UdpSocket, IoExn))send_to : (UdpSocket) fn(self : UdpSocket, data : ArrayList(u8), addr : SocketAddr, io : Io) -> Impl(Future(i32, IoExn))Send a datagram to a specific address. Returns the number of bytes sent.
Parameters
| Name | Type | Notes |
|---|---|---|
self | UdpSocket | |
data | ArrayList(u8) | |
addr | SocketAddr | |
io | Io |
Returns: Impl(Future(i32, IoExn))
recv : (UdpSocket) fn(self : UdpSocket, buf : *(u8), size : usize, io : Io) -> Impl(Future(i32, IoExn))recv_from : (UdpSocket) fn(self : UdpSocket, buf : *(u8), size : usize, src_addr : *(u8), src_addr_len : *(u32), io : Io) -> Impl(Future(i32, IoExn))send : (UdpSocket) fn(self : UdpSocket, data : ArrayList(u8), io : Io) -> Impl(Future(i32, IoExn))close : (UdpSocket) fn(self : UdpSocket, io : Io) -> Impl(Future(unit, IoExn))set_broadcast : (UdpSocket) fn(self : UdpSocket, enabled : bool, io : Io) -> Impl(Future(unit, IoExn))local_addr : (UdpSocket) fn(self : UdpSocket) -> SocketAddrGet the local address this socket is bound to.
Parameters
| Name | Type | Notes |
|---|---|---|
self | UdpSocket |
Returns: SocketAddr
fd : (UdpSocket) fn(self : UdpSocket) -> i32impl(UdpSocket, Dispose(...))
dispose : (fn(self : Self) -> unit)Returns: unit