Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Sockets/Rust/sockets.rust
Normal file
11
Task/Sockets/Rust/sockets.rust
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use std::io::prelude::*;
|
||||
use std::net::TcpStream;
|
||||
|
||||
fn main() {
|
||||
// Open a tcp socket connecting to 127.0.0.1:256, no error handling (unwrap)
|
||||
let mut my_stream = TcpStream::connect("127.0.0.1:256").unwrap();
|
||||
|
||||
// Write 'hello socket world' to the stream, ignoring the result of write
|
||||
let _ = my_stream.write(b"hello socket world");
|
||||
|
||||
} // <- my_stream's drop function gets called, which closes the socket
|
||||
Loading…
Add table
Add a link
Reference in a new issue