I have a .NET Remoting application. Currently the application has functionality in which Remoting Server is required to fetch the file and send it to client as byte array. As the whole byte array is going to client at once, if the file size is big, then there is problem.
So I am thinking of implementing partial reading of the file,
like
public byte[] ReadPartialFile(string fileName, int offset, int bufferSize)
{
//use FileStream and BinaryReader to read the required (depends of offset and buffer) bytes and send them back...
}
But I am afraid that if file is large and buffer size small, the FileStream and related objects would be created and disposed of N number of times, which can adversely impact the application....
I also don't want to spike application's (client & server) memory consumption...
Anyone got better ideas...