Skip to content

Instantly share code, notes, and snippets.

@spacejam
Created January 28, 2019 10:59
Show Gist options
  • Save spacejam/705944fb058453babf67fa77e6839e8a to your computer and use it in GitHub Desktop.
Save spacejam/705944fb058453babf67fa77e6839e8a to your computer and use it in GitHub Desktop.
use std::io::{Result, Read, Write};
use std::net::{TcpListener, TcpStream};
fn handle_client(
mut stream: TcpStream,
state: &mut Vec<String>,
) -> Result<()> {
Ok(())
}
fn main() -> Result<()> {
let listener = TcpListener::bind("127.0.0.1:8000")
.expect("should be able to bind");
let mut state = vec![];
for socket in listener.incoming() {
handle_client(socket?, &mut state)?;
}
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment