Crates.io | udp_wrapper |
lib.rs | udp_wrapper |
version | 0.2.1 |
source | src |
created_at | 2022-02-06 19:19:49.596371 |
updated_at | 2022-03-01 21:13:20.145128 |
description | It's a simple library to smart_house |
homepage | https://github.com/zhuravlevma |
repository | https://github.com/zhuravlevma/smart-house-lib |
max_upload_size | |
id | 527980 |
size | 17,217 |
[dependencies]
udp_wrapper = "0.2"
tokio = { version = "1", features = ["full"] }
Then, on your main.rs:
async fn main() -> Result<(), Box<dyn Error>> {
let server = UdpServerAsync::new("127.0.0.1:9001".to_string()).await?;
let (_usize, address, data) = server.receive().await?;
server.response(data, address);
}
[dependencies]
udp_wrapper = "0.2"
tokio = { version = "1", features = ["full"] }
Then, on your main.rs:
use udp_wrapper::UdpServer;
use std::error::Error;
async fn main() -> Result<(), Box<dyn Error>> {
let server = UdpServer::new("127.0.0.1:9001".to_string())?;
server.receive()
}
[dependencies]
udp_wrapper = "0.2"
tokio = { version = "1", features = ["full"] }
Then, on your main.rs:
async fn main() -> Result<(), Box<dyn Error>> {
let client = UdpClient::new("127.0.0.1:9001".to_string())?;
let response = client.send("Hello, I'm a client".to_string(), "127.0.0.1:9001".to_string())?;
}
[dependencies]
udp_wrapper = "0.2"
tokio = { version = "1", features = ["full"] }
Then, on your main.rs:
use udp_wrapper::UdpPusher;
use std::error::Error;
async fn main() -> Result<(), Box<dyn Error>> {
let pusher = UdpPusher::new("127.0.0.1:9001".to_string())?;
pusher.send("Hello, I'm pusher".to_string(), "127.0.0.1:8081".to_string())?;
Ok(())
}
This project is licensed under the MIT license.