mirror of
https://github.com/xvxx/phetch
synced 2024-11-05 00:00:58 +00:00
basic
This commit is contained in:
parent
3a201fa65d
commit
47212040c1
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal 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"
|
||||
|
17
src/main.rs
17
src/main.rs
@ -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);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user