How much data can be stored in network buffer when datareader is used

后端 未结 1 1828
春和景丽
春和景丽 2021-01-20 16:22

all we know that datareader works like

The datareader reads a record at a time, but it reads it from the underlying database driver. The database driver reads data f

相关标签:
1条回答
  • 2021-01-20 17:09

    Depending on your setup have a read of this Default Result Set Processing and Multiple Active Result Sets and Rowsets and SQL Server Cursors

    Look into TcpClient.ReceiveBufferSize it will tell you how much raw data can be read in one operation.

    "The ReceiveBufferSize property gets or sets the number of bytes that you are expecting to store in the receive buffer for each read operation. This property actually manipulates the network buffer space allocated for receiving incoming data.

    Your network buffer should be at least as large as your application buffer to ensure that the desired data will be available when you call the NetworkStream.Read method. Use the ReceiveBufferSize property to set this size. If your application will be receiving bulk data, you should pass the Read method a very large application buffer.

    If the network buffer is smaller than the amount of data you request in the Read method, you will not be able to retrieve the desired amount of data in one read operation. This incurs the overhead of additional calls to the Read method."

    and then read about NetworkStream.Read

    At which point you will have a better idea of the complexity of the answer to your question.

    0 讨论(0)
提交回复
热议问题