2
0
mirror of https://github.com/xvxx/phetch synced 2024-11-05 00:00:58 +00:00
This commit is contained in:
dvkt 2019-11-21 23:43:20 -08:00
parent 3a201fa65d
commit 47212040c1
2 changed files with 22 additions and 1 deletions

6
Cargo.lock generated Normal file
View File

@ -0,0 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "phetch"
version = "0.1.0"

View File

@ -1,3 +1,18 @@
#![allow(unused_must_use)]
use std::io::{Read, Write};
use std::net::TcpStream;
fn main() {
println!("Hello, world!");
TcpStream::connect("phkt.io:70")
.and_then(|mut stream| {
stream.write("\r\n".as_ref()).unwrap();
let mut buf = String::new();
stream.read_to_string(&mut buf);
println!("{}", buf);
Ok(())
})
.map_err(|err| {
eprintln!("err: {}", err);
});
}