Crate mezzenger_udp

source ·
Expand description

Transport for communication over tokio UDP implementation.

NOTE: This transport inherits UDP properties:

  • it is unreliable - messages are not guaranteed to reach destination,
  • it is unordered - messages may arrive at destination out of order, also they may be duplicated (the same message may arrive at destination twice or more times).
  • message size is limited to datagram size - sending may result in error if encoded message is too large.

See repository for more info.

Example

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?;

Structs

Transport over tokio’s UDP implementation.

Enums