Created
June 16, 2022 03:57
-
-
Save atsushi-kitazawa/62e0cd9ea98863b73420ad46bf96db5f to your computer and use it in GitHub Desktop.
rust tcp server (wip)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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