client/client.rs
1fn main() {
2 // create a connection to our example server in server.rs
3 let mut connection = std::net::TcpStream::connect("localhost:3333").expect("Failed to connect to server!");
4
5 // create a writer
6 let mut writer = send_it::writer::VarWriter::default();
7
8 // add two segments: "Hello, " and "world!"
9 writer.add_string("Hello, ");
10 writer.add_string("world!");
11
12 // send our two segments to the TcpStream and exit
13 writer.send(&mut connection).expect("Failed to send data!");
14 println!("sent data!");
15}