rust tcp server frame.

client crate url

Examples Echo

``` rust

![feature(async_closure)]

use anyhow::Result; use std::sync::Arc; use tcpserver::{Builder, IPeer, ITCPServer}; use tokio::io::AsyncReadExt;

[tokio::main]

async fn main() -> Result<()> { let tcpserver: Arcconnectevent(|addr| { println!("{:?} connect", addr); true }) .setstreaminit(async move |tcpstream| Ok(tcpstream)) .setinputevent(async move |mut reader, peer, token| { let mut buff = [0; 4096]; while let Ok(len) = reader.read(&mut buff).await { if len == 0 { break; } peer.sendref(buff[..len].tovec()).await?; } println!("{:?} disconnect", peer.addr()); Ok(()) }) .build() .await; tcpserver.startblock(()).await?; Ok(()) }

```