Add explanatory comments to exercise 258

main
Emelie Graven 2022-04-04 08:21:07 +02:00
parent 6ff23340af
commit 7ad3a06072
Signed by: emelie
GPG Key ID: C11123726DBB55A1
1 changed files with 2 additions and 0 deletions

View File

@ -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);