I have a problem implementing a Read() with timeout.
I have a TcpClient obtained via listener:
let listener = new TcpListener(IPAddress.Any, 6667)
let client = listener.AcceptTcpClient()
and I tried this code to have a Read with timeout:
let stream = client.GetStream()
stream.ReadTimeout <- 5000
try Some(stream.ReadByte()) with _ -> None
which works fine. The problem is that, when the timeout happens, client.Connected becomes false !!
And that's false because the socket is still alive and I'm still able to Write/Read data through the stream.
Also, because client.Connected is false, I'm not able anymore to invoke the GetStream() method.
I think this is a big bug, isn't it?
I forgot to mention that it happens the same setting either client.ReceiveTimeout and/or stream.ReadTimeout...
View Complete Post