Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much buffer does NetworkStream and TcpClient have?

We are writing a TCPServer and Client program. How much space is there in the TcpClient buffer? Like, at what point will it begin to throw away data? We are trying to determine if the TcpClient can be blocking or if it should go into it's own background thread(so that the buffer can not get full)..

like image 777
Earlz Avatar asked Mar 28 '10 18:03

Earlz


1 Answers

You can get the buffer sizes from TcpClient.ReceiveBufferSize and TcpClient.SendBufferSize .

The available buffer sizes will vary as data is received/acknowledged(or not) at the TCP level. TcpClient is blocking by default.

No data will be thrown away as a result of full buffers, though data could be throw away in under error conditions (such as the peer disappears/crashes/exits etc.)

like image 167
nos Avatar answered Sep 28 '22 08:09

nos