TcpListener reset


I written a TCP server that handle text commands (a SCPI server), but I probably missunderstand std::net::TcpListener because when a program send two requests, the second returns a reset response.


What’s happening here is your server reads a single line from the socket, does some processing and then drops the stream, closing the socket. The client probably thinks the connection is still open and attempts to send a second request, and the server responds with a reset because no such connection exists.

You probably want to loop in the server thread, trying to read more data.


You right, I read only one line per connection:

Thank you.