You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
423 B

use std::net::{TcpStream, TcpListener};
use std::io::prelude::*;
use std::io;
fn main() {
let address = "127.0.0.1:8000";
let mut text = String::new();
let mut stream = TcpStream::connect(address).expect("connection failed");
write!(stream,"hello from the client!\n").expect("write failed");
stream.read_to_string(&mut text).expect("read failed");
println!("received: '{}'", text.trim_right());
}