tokio-rs/tokio-line

How to close the connection in server side?

Opened this issue · 2 comments

zoumi commented

It seems that return Box::new(future::done(Ok(req))) doesn't close the connection.
My client side:

        let mut socket = TcpStream::connect(addr).unwrap();
        socket.write(msg.as_bytes());

        let mut result = String::new();

        println!("waitiing for server to return");
        let response = socket.read_to_string(&mut result);
        info!("the server return: {}", result);

will block at socket.read_to_string()

@zoumi have you found a way to do it?

zoumi commented

Not really. I read data to buf with a fixed len, print it, then eixit the client process.(I don't care what server returns in that app).
I don't understand what alexcricht said. We can not close connection at server side?
Should I close this issue?