Skip to content

Instantly share code, notes, and snippets.

@atsushi-kitazawa
Created June 16, 2022 03:57
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 atsushi-kitazawa/62e0cd9ea98863b73420ad46bf96db5f to your computer and use it in GitHub Desktop.
Save atsushi-kitazawa/62e0cd9ea98863b73420ad46bf96db5f to your computer and use it in GitHub Desktop.
rust tcp server (wip)
use std::net::TcpListener;
fn main() {
let result = TcpListener::bind("127.0.0.1:8888");
match result {
Result::Ok(listner) => {
let stream = listner.accept();
match stream {
Result::Ok((mut _stream, _)) => {println!("OK")},
Result::Err(_e) => {println!("NG: accept()")},
}
},
Result::Err(_e) => {println!("NG: bind()")},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment