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, using(io : IO)) -> Impl(Future(UdpSocket, IO, Exception))send_to : (UdpSocket) fn(self : UdpSocket, data : ArrayList(u8), addr : SocketAddr, using(io : IO)) -> Impl(Future(i32, IO, Exception))Send a datagram to a specific address. Returns the number of bytes sent.
Parameters
| Name | Type | Notes |
|---|---|---|
self | UdpSocket | |
data | ArrayList(u8) | |
addr | SocketAddr |
recv : (UdpSocket) fn(self : UdpSocket, buf : *(u8), size : usize, using(io : IO)) -> Impl(Future(i32, IO, Exception))recv_from : (UdpSocket) fn(self : UdpSocket, buf : *(u8), size : usize, src_addr : *(u8), src_addr_len : *(u32), using(io : IO)) -> Impl(Future(i32, IO, Exception))send : (UdpSocket) fn(self : UdpSocket, data : ArrayList(u8), using(io : IO)) -> Impl(Future(i32, IO, Exception))close : (UdpSocket) fn(self : UdpSocket, using(io : IO)) -> Impl(Future(unit, IO, Exception))set_broadcast : (UdpSocket) fn(self : UdpSocket, enabled : bool, using(io : IO)) -> Impl(Future(unit, IO, Exception))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