We need to be able to send and receive data on the socket concurrently (or similar to that with a non-blocking or asynchronous approach). This is so that we can send pings every so often to check the state of the socket, and so that other people using this as a library could send commands without having to wait for a recv call to happen first (ex, sending a message to a buffer).
Originally, I was planning to simply use try_clone on the socket, and setup 1 thread for receiving and 1 thread for sending. However, apparently this doesn't working ok SSL sockets (see rust-openssl/rust-openssl#338 and http://stackoverflow.com/questions/14467630). With that out of the question, I think using a non-blocking socket to do both the sends and receives is probably the best way to go.
We need to be able to send and receive data on the socket concurrently (or similar to that with a non-blocking or asynchronous approach). This is so that we can send pings every so often to check the state of the socket, and so that other people using this as a library could send commands without having to wait for a recv call to happen first (ex, sending a message to a buffer).
Originally, I was planning to simply use try_clone on the socket, and setup 1 thread for receiving and 1 thread for sending. However, apparently this doesn't working ok SSL sockets (see rust-openssl/rust-openssl#338 and http://stackoverflow.com/questions/14467630). With that out of the question, I think using a non-blocking socket to do both the sends and receives is probably the best way to go.