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