Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 925 Bytes
// This example sends four messages called data portions to the
// website using a single system call on an orginary TcpStream.
use sendmmsg::SendMMsg;
use std::io::IoVec;
use std::net::TcpStream;
fn main() {
// Specify all the messages you want to send
let messages = &mut [
(0, IoVec::new(b"Generals gathered in their masses")),
(0, IoVec::new(b"Just like witches at black masses")),
(0, IoVec::new(b"Evil minds that plot destruction")),
(0, IoVec::new(b"Sorcerers of death's construction")),
// 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(packets) => println!("Packets sent: {}", packets),
You can’t perform that action at this time.