Browse Source

Add explanatory comments to exercise 258

main
Emelie Graven 3 months ago
parent
commit
7ad3a06072
Signed by: emelie GPG Key ID: C11123726DBB55A1
  1. 2
      e_258/src/main.rs

2
e_258/src/main.rs

@ -87,12 +87,14 @@ const REAL_NAME: &str = "dailyprog_2851";
fn main() -> Result<(), Box<dyn Error>> {
let mut stream = TcpStream::connect(SERVER)?;
// Send initial NICK and USER commands
stream.write_all((String::from("NICK ") + NICK + "\r\n").as_bytes())?;
stream.write_all(
(String::from("USER ") + USER_NAME + " 0 * :" + REAL_NAME + "\r\n").as_bytes(),
)?;
let mut reader = BufReader::new(stream);
let mut line = String::new();
// Loop indefinitely, printing any incoming messages to stdout and responding to PINGs
loop {
reader.read_line(&mut line)?;
println!("{}", &line);

Loading…
Cancel
Save