When transferring large quantities of data, consider using a Stream object.
The use of a Stream object will automatically break the data into smaller
chucks.
As an example, here's a simple Remoting object:
public class RemotingObject : MarshalByRefObject
{
public Stream GetLargeAmountsOfData()
{
return new FileStream("c:\\Temp\\data.dat", FileMode.Open);
}
}
Here's how a client might call and use this object to retrieve data in chunks.
public class Client
{
public void GetRemotingData()
{
RemotingObject ro = Activator.GetObject(typeof(RemotingObject),
"tcp://localhost:1234/RO.rem");
Stream s = ro.GetLargeAmountsOfData();
byte[] data = new byte[1024 * 64];
int bytesToRead = s.Length();
while (bytesToRead > 0)
{
bytesToRead -= s.Read(data, 0, data.Length);
//do something with the data
}
}
}