shitty message client
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
726 B

  1. // namespacing
  2. use crate::config::ClientConfig as Config;
  3. use crate::Result;
  4. use async_std::net::TcpStream;
  5. /*use futures::io::ReadHalf;*/
  6. use futures_util::io::AsyncReadExt;
  7. /// wraps the client
  8. pub async fn client(port: u16) -> Result<()> {
  9. let _config = Config::load()?;
  10. let mut stream = TcpStream::connect(format!("127.0.0.1:{}", &port)).await?;
  11. println!("connection established to: {}:{}", stream.peer_addr()?.ip(), port);
  12. let message = ilmp::Message::new(
  13. "Isabelle".to_owned(),
  14. "oh god oh fuck this shit actually works".to_owned(),
  15. );
  16. ilmp::write(&mut stream, message, ilmp::NoEncrypt::new()).await;
  17. loop {}
  18. /*let (read, mut write) = stream.split();*/
  19. Ok(())
  20. }