Does a BinaryFormatter consume the bytes if an exception throws

63 Views Asked by At

I'm trying to use a BinaryFormatter to send and receive message in C# using a NetworkStream ( got from a TcpClient ). When I do formatter.Deserialize( Stream ), the program block until the client send something. I am wondering, if I set a timeout on the TcpClient, is the BinaryFormatter going to consume the bytes it has read before the exception throws ?

Is theres an other way to do this ?

Is it possible to check if the entire message is receive, without any timeout ? ( Something faster )

Thank you,

0

There are 0 best solutions below