5 releases

0.1.4 May 4, 2022
0.1.3 Apr 22, 2022
0.1.2 Jul 8, 2021
0.1.1 Jul 8, 2021
0.1.0 Jun 25, 2021

#10 in #broadcast

MIT license

13KB
295 lines

🌏 YMMP: Yumetter Messaging Protocol

Prerequisites

  • Rust Toolchain 1.53.0+

Summary

YMMP is a protocol for broadcast a notification to all nodes within the network or subnet, made for Yumetter project. The lower layer protocol is UDP (User Diagram Protocol), and uses port 17339 by default.

Usage

use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};

fn main() {
    let addr = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 17339);
    let target = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::BROADCAST, 17339));
    let broadcaster = ymmp::Broadcaster::bind(addr, target);

    let message = vec![b'h', b'e', b'l', b'l', b'o'];
    let packet = ymmp::Packet::new(message);

    broadcaster
        .broadcast(packet)
        .expect("Failed to broadcast.")
    ;
}

Diagram

0 1 2 3 4 5 6 7
0 Magic Bytes (YMMP) Version (v0.1)
8 Length of Message (Little Endian)
16 Raw Message (0..N octets)
32

Dependencies

~3–11MB
~106K SLoC