Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 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