tokio-line icon indicating copy to clipboard operation
tokio-line copied to clipboard

How to close the connection in server side?

Open zoumi opened this issue 7 years ago • 2 comments

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 avatar Oct 14 '17 10:10 zoumi

@zoumi have you found a way to do it?

khaledkbadr avatar Jan 05 '18 21:01 khaledkbadr

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?

zoumi avatar Jan 10 '18 13:01 zoumi