DEPRECATED SINCE 28-06-2019: this is an incomplete wrapper, and you'd better use https://docs.rs/libc/0.2.58/libc/fn.sendmmsg.html for now. Also support for nix is coming soon.

sendmmsg


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.

Pulse · Stargazers · Releases · Contributing


Usage

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

(examples/sender.rs) ```rust 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".asbytes()), (0, "Just like witches at black masses".asbytes()), (0, "Evil minds that plot destruction".asbytes()), (0, "Sorcerers of death's construction".asbytes()), ];

// Setup the `TcpStream` instance connected to example.com
let socket = TcpStream::connect("93.184.216.34:80").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.


Contributing

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.


Contacts

Temirkhan Myrzamadi <gymmasssorla@gmail.com> (the author)