TcpListener reset


#1

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.


#2

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.


#3

You right, I read only one line per connection: https://github.com/yellow-pitaya/scpi-server/blob/master/src/server.rs#L123

Thank you.