Daniel Laptop 2 years ago
parent
commit
9f0f5d8a3d
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/bin/client.rs

+ 6
- 6
src/bin/client.rs View File

@@ -4,7 +4,7 @@ use std::net::TcpStream;
fn main() {
//let stream = TcpStream::connect("172.30.16.1:8080");
//let stream = TcpStream::connect("27.0.0.1:8080");
match TcpStream::connect("localhost:3333") {
match TcpStream::connect("localhost:7878") {
Ok(mut stream) => {
println!("Successfully connected to server");

@@ -12,12 +12,12 @@ fn main() {
let mut buffer = String::new();
match std::io::stdin().read_line(&mut buffer) {
Ok(n) => {
if n == 0 {
break;
}
if n == 0 {
break; // Beenden bei EOF
}
println!("Sending {}", buffer);
stream.write(buffer.as_bytes()).unwrap();
println!("Sent {}, awaiting reply...", buffer);
println!("Sent {}, awaiting reply ...", buffer);
}
Err(error) => {
println!("error: {error}");
@@ -25,7 +25,7 @@ fn main() {
}
}
}
},
}
Err(e) => {
println!("Failed to connect: {}", e);
}

Loading…
Cancel
Save