Hi all! I'm new to socket / network programming and trying to learn it in Rust. I have a simple client and server which communicate by sending JSON messages (using serde_json for this). For sending the message to TcpStream, I'm using serde_json::to_writer(stream, &message) and on the server side, I'm reading the message by serde_json::from_reader(stream).
All of this works fine but I want to a way for the server to tell the client that they sent the wrong message (say, a missing field), how would I go about doing that?
On the server, is it okay to write to the same TcpStream from which its reading or is there another way?