Skip to content

Instantly share code, notes, and snippets.

@skade
Last active October 28, 2015 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skade/6ad1c238ba439d77626c to your computer and use it in GitHub Desktop.
Save skade/6ad1c238ba439d77626c to your computer and use it in GitHub Desktop.
function_to_copy
use std::net::{TcpListener, TcpStream};
use std::io::BufReader;
use std::io::BufRead;
use std::io::Write;
fn read_message(stream: &mut TcpStream) -> String {
let mut read_buffer = String::new();
let mut buffered_stream = BufReader::new(stream);
let res = buffered_stream.read_line(&mut read_buffer);
res.ok().expect("An error occured while reading!");
read_buffer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment