diff --git a/src/main.rs b/src/main.rs index fe70140..d308139 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,9 +9,12 @@ use tokio::net::TcpStream; async fn main() -> Result<(), Box> { let mut stream = TcpStream::connect("irc.freenode.net:6667").await?; stream.writable().await?; + stream.write(b"NICK garrit\r\n").await?; - stream.write(b"USER garrit 8 x : garrit").await?; - stream.write(b"JOIN #antimony").await?; + stream.write(b"USER garrit 8 x : garrit\r\n").await?; + stream.write(b"JOIN #antimony\r\n").await?; + + stream.write(b"PRIVMSG #antimony :Hi from Rust!\r\n").await?; loop { @@ -20,7 +23,7 @@ async fn main() -> Result<(), Box> { // Creating the buffer **after** the `await` prevents it from // being stored in the async task. - let mut buf = [0; 8]; + let mut buf = [0; 1024]; // Try to read data, this may still fail with `WouldBlock` // if the readiness event is a false positive. @@ -39,5 +42,7 @@ async fn main() -> Result<(), Box> { } } + println!("I was called!"); + Ok(()) }