Thread: [Opentnl-general] Problem with large data buffers ?
Brought to you by:
mark_frohnmayer,
s_alanet
From: Ivan V. <iv...@gm...> - 2005-10-04 11:05:32
|
Hi. Thanks for this magic library - very impressive, especially RPCs. I'm new to OpenTNL, so please, correct me, if I'm wrong. I'm trying to send big data chunk, using ByteBufferPtr as parameter in one of RPCs. It works fine for buffers<1500 Bytes but fails for larger data buffers. I found that TNL uses PacketStream with internal buffer of 1500 Bytes to send data, but I was really wondered that TNL can't break large buffer to small packets. Am I doing something wrong? Any better ways to send large data blocks? Thanks in advance! Ivan V |
From: Ben G. <be...@ga...> - 2005-10-04 17:58:34
|
Ivan Vorobeychyk wrote: >Hi. >Thanks for this magic library - very impressive, especially RPCs. >I'm new to OpenTNL, so please, correct me, if I'm wrong. >I'm trying to send big data chunk, using ByteBufferPtr as parameter >in one of RPCs. It works fine for buffers<1500 Bytes but fails for larger >data buffers. I found that TNL uses PacketStream with internal >buffer of 1500 Bytes to send data, but I was really wondered that TNL >can't break large buffer to small packets. > > Hi Ivan, As it happens, you have to break your own data into chunks. TNL doesn't try to hide the nature of the transport from you, so as a result it won't work behind the scenes to allow you to do things like span data over multiple packets. In general for a realtime network connection doing that is a bad idea - if you get half of an update and the other half gets stalled somewhere out in the internet, then you might be in a great deal of trouble till it gets resolved! If you're trying to transfer large buffers in a non-realtime setting, then the easiest thing to do is cut the buffer up into, say, 300-400 byte chunks and send it by a series of guaranteed RPC calls or events. I've implemented some file transfer apps this way; it's quick and easy. If it's a very large file you might want to only try to keep a dozen or so calls/events in flight, and wait till one has been received before sending the next. Regards, Ben Garney |