pub async fn start(
    bind_addr: SocketAddr,
    send: Sender<TransportRecvMessage>,
    recv: Receiver<TransportSendMessage>,
) -> Result<()> {
    let listener = TcpListener::bind(bind_addr).await.map_err(|e| {
        error!("Chamomile TCP listen {:?}", e);
        std::io::Error::new(std::io::ErrorKind::Other, "TCP Listen")
    })?;

    // TCP listen incoming.
    tokio::spawn(run_listen(listener, send.clone()));

    // TCP listen from outside.
    tokio::spawn(run_self_recv(recv, send));

    Ok(())
}
/// Init and run a TcpEndpoint object.
/// You need send a socketaddr str and tcp send message's addr,
/// and receiver outside message addr.
Init and run a TcpEndpoint object.
You need send a socketaddr str and tcp send message's addr,
and receiver outside message addr.
Init and run a TcpEndpoint object . You need send a socketaddr str and tcp send message ' s addr and receiver outside message addr .
pub async fn start(
    bind_addr: SocketAddr,
    send: Sender<TransportRecvMessage>,
    recv: Receiver<TransportSendMessage>,
) -> Result<()> {
    let listener = TcpListener::bind(bind_addr).await.map_err(|e| {
        error!("Chamomile TCP listen {:?}", e);
        std::io::Error::new(std::io::ErrorKind::Other, "TCP Listen")
    })?;
    // TCP listen incoming.
    tokio::spawn(run_listen(listener, send.clone()));
    // TCP listen from outside.
    tokio::spawn(run_self_recv(recv, send));
    Ok(())
}
pub async fn start ( bind_addr : SocketAddr , send : Sender < TransportRecvMessage > , recv : Receiver < TransportSendMessage > , ) -> Result < ( ) > { let listener = TcpListener :: bind ( bind_addr ) . await . map_err ( | e | { error ! ( " " e ) ; std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " ) } ) ? ; // TCP listen incoming. tokio :: spawn ( run_listen ( listener , send . clone ( ) ) ) ; // TCP listen from outside. tokio :: spawn ( run_self_recv ( recv , send ) ) ; Ok ( ( ) ) }
Init and run a TcpEndpoint object.
Init and run a TcpEndpoint object .
bind_addr
SocketAddr
send
Sender<TransportRecvMessage>
recv
Receiver<TransportSendMessage>
bind_addr
SocketAddr
send
Sender<TransportRecvMessage>
recv
Receiver<TransportSendMessage>