sendmmsg 0.3.6

Transmit multiple messages using one system call in Rust

DEPRECATED SINCE 28-06-2019: this is an incomplete wrapper, and you'd better use for now. Also support for nix is coming soon.

This crate provides a convenient approach for transmitting multiple messages using one system call (but only on Linux-based operating systems), which will increase performance for large data sets. TCP and UDP protocols are supported.


This example sends four messages called data portions to the website using a single system call on an orginary TcpStream:


use std::net::TcpStream;

use sendmmsg::SendMMsg;

fn main() {
    // Specify all the messages you want to send
    let messages = &mut [
        (0, "Generals gathered in their masses".as_bytes()),
        (0, "Just like witches at black masses".as_bytes()),
        (0, "Evil minds that plot destruction".as_bytes()),
        (0, "Sorcerers of death's construction".as_bytes()),

    // Setup the `TcpStream` instance connected to
    let socket = TcpStream::connect("").unwrap();

    // Finally, send all the messages above
    match socket.sendmmsg(messages) {
        Err(error) => eprintln!("An error occurred: {}!", error),
        Ok(portions) => println!("Portions sent: {}", portions),

More realistic examples are located in the examples directory (and you are able to run them). To investigate the library abstractions, visit the official documentation.


You are always welcome for any contribution to this project! But before you start, you should read the appropriate document to know about the preferred development process and the basic communication rules.


Temirkhan Myrzamadi <> (the author)