pub fn udp<L: Into<Option<SocketAddr>>, R: Into<Addr>>(
remote_addr: R,
local_addr: L,
) -> BuilderAvailable on crate features
blocking or tokio only.Expand description
Shortcut method to create a UDP connection. If local_addr is not provided then we will bind to “0.0.0.0:0” (all addresses, random port).
§Examples
Supports both blocking and tokio. Swap about connect_async for connect and remove the
.await annotations.
let conn = insim::udp("127.0.0.1:29999", None).connect_async().await?;
loop {
let packet = conn.read().await?;
println!("{:?}", packet);
}