views:

38

answers:

2

I am experimenting with the Tcp connections in .NET and I would like to send some data that is larger than the SendBufferSize proporty of the TcpClient object. Is it possible to send the data by simply writing to the network stream or do I need to cut it in pices and send those and at the other end create it again?

+1  A: 

If the network buffer is smaller than the amount of data you provide the Write method, several network send operations will be performed for every call you make to the Write method. You can achieve greater data throughput by ensuring that your network buffer is at least as large as your application buffer.

from .NET Framework Class Library - TcpClient.SendBufferSize Property

FloE
+2  A: 

From MSDN:

If the network buffer is smaller than the amount of data you provide the Write method, several network send operations will be performed for every call you make to the Write method.

You only need to call Write once, the TcpClient will handle splitting it into multiple network operations.

Phil Lamb