all groups > dotnet remoting > april 2007 >
You're in the

dotnet remoting

group:

Help! What is the maximum size of a byte array that can be returned over remoting?


Help! What is the maximum size of a byte array that can be returned over remoting? Nanker
4/10/2007 7:09:49 AM
dotnet remoting:
I'm working with a .NET application that uses remoting to communicate
between the web layer and an application layer, and one method returns
a byte array containing the contents of a file. The file sizes have
been up to 40 MB previously, and were returned with now problem.
However, now there are some 70 MB files, and whenever a byte array
containing the contents of one of these 70 MB files is returned, the
web layer client gets a Socket exception stating:


An operation on a socket could not be performed because the system
lacked sufficient buffer space or because a queue was full.


with the following Server stack trace:


at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32
offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.Connection.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.InternalBeginRead(Int32 bytesToRead,
NestedSingleAsyncResult castedAsyncResult, Boolean fromCallback)
at System.Net.ConnectStream.BeginReadWithoutValidation(Byte[]
buffer, Int32 offset, Int32 size, AsyncCallback callback, Object
state)
at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32
count)
at System.IO.BinaryReader.ReadBytes(Int32 count)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadArrayAsBytes(ParseRecord
pr)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadArray(BinaryHeaderEnum
binaryHeaderEnum)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream
inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)


This would lead me to believe that this is an issue with the size of
the byte array that is being returned. I've done some digging to try
to find out where/if the maximum object size returned over a remoting
boundary is defined, but I haven't been successful.

- Is there a maximum size of a return value for a remoting interface?
- This is existing legacy code, but is there a better approach to
getting this file content to the web layer? Due to security/network
restrictions, the web layer servers do not have direct access to the
file system where these files are stored.

Thanks in advance
Re: Help! What is the maximum size of a byte array that can be returned over remoting? Bryan Phillips
4/11/2007 2:29:39 AM
I don't know the exact size, but I break up files into 64 KB chunks
before transferring them.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net



[quoted text, click to view]
AddThis Social Bookmark Button