Closed
Description
TcpStream
is conceptually two distinct parts: a reader and a writer. In theory you should be able to write data while in the middle of being blocked trying to read. But a TcpStream
cannot be shared between tasks, so there is no way to write code to do this.
To that end, TcpStream
should have a split()
method that returns (TcpWriter, TcpReader)
which each implement one half of the TcpStream
. This would allow each half to be sent to a separate task.
One practical reason for this is to be able to wrap a TcpStream
in a pair of (Port<~[u8], Chan<~[u8]>)
s. This requires a split stream and two tasks.