mirror of https://github.com/xvxx/phetch
basic
parent
3a201fa65d
commit
47212040c1
@ -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"
|
||||||
|
|
@ -1,3 +1,18 @@
|
|||||||
|
#![allow(unused_must_use)]
|
||||||
|
|
||||||
|
use std::io::{Read, Write};
|
||||||
|
use std::net::TcpStream;
|
||||||
|
|
||||||
fn main() {
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue