I am using a TcpStream. I could not really find a concrete answer that indicates that I can read and write from the socket at the same time like with C. I really need to do this, since I have a struct that is constantly waiting for messages, and sometimes I have to send messages through the same stream. I already saw this post: How do I handle parallel reads and writes on a TcpStream? but try_clone does not really specify that this allows for parallel reads and writes, and I have read some posts and github issues saying that parallelism should be possible (implying that it is not). This is all with standard Rust, I am not allowed to use any framework or external crate.
Because I thought the stream was not thread safe I wrapped it in a RwLock, but now I realized that generates a deadlock, since the thread that is always waiting for a message has the lock.