ymmp

Crates.ioymmp
lib.rsymmp
version0.1.4
sourcesrc
created_at2021-06-25 02:52:37.709778
updated_at2022-05-04 09:53:30.542458
descriptionYumetter Messaging Protocol
homepagehttps://github.com/siketyan/ymmp
repositoryhttps://github.com/siketyan/ymmp.git
max_upload_size
id414672
size15,877
corporate-engineering (github:yumemi-inc:corporate-engineering)

documentation

README

🌏 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
Commit count: 26

cargo fmt