Crates.io | mezzenger-udp |
lib.rs | mezzenger-udp |
version | 0.1.5 |
source | src |
created_at | 2022-11-11 14:41:42.646518 |
updated_at | 2023-09-13 13:46:45.899965 |
description | UDP mezzenger transport. |
homepage | https://github.com/zduny/mezzenger/tree/master/mezzenger-udp |
repository | https://github.com/zduny/mezzenger |
max_upload_size | |
id | 712883 |
size | 61,520 |
UDP transport for mezzenger.
https://crates.io/crates/mezzenger-udp
Add dependencies to Cargo.toml
:
[dependencies]
# ...
serde = { version = "1", features = ["derive"] }
kodec = { version = "0.1.0", features = ["binary"] } # or json or different one from another crate...
mezzenger = "0.1.3"
mezzenger-udp = "0.1.2"
Now, in code:
let udp_socket = UdpSocket::bind("127.0.0.1:8080").await?;
udp_socket.connect(remote_address).await?;
use kodec::binary::Codec;
let mut transport: Transport<_, Codec, i32, String> =
Transport::new(udp_socket, Codec::default());
use mezzenger::Receive;
let integer = transport.receive().await?;
transport.send("Hello World!".to_string()).await?;