Read-only archive of the All About Symbian forum (2001–2013) · About this archive

Socket Send() problem with TSockXfrLength

1 replies · 4,928 views · Started 11 April 2007

I have a problem with Send() routine. It seems that I can't send more than certain amount of data (say 512B or 1KB). What could be the source of this problem? Does this routine use some internal buffers (or some of the user-defined ones) and do they have some fixed length (or where do I set it if it is user defined)?
The problem is that when I try to send 5KB of data - the program breaks (I'm using UIQ3 emulator to test it). According to the log - this routine gets executed once so I figured out I should be calling it couple of times in order to send the whole lot. Then I thought that I need to know how much data I already sent in order to know how much more I need to send. According to UIQ3 SDK documentation - that information should be stored in the fourth argument of the routine. However, I can't extract or interpret that information. To me it seems that iLength (see below) is always 0. I'm pasting a piece of code so please tell me if I'm doing something the wrong way. Also, please comment on buffer sizes I mentioned above if you have some information.
Thanks, elgrande

----------------------------------------
...
TSockXfrLength iLength;
RSocket iSocket;
TRequestStatus* iStatus;
HBufC8* iData;
...
TPtr8 ptr(iData->Des());
iSocket.Send(ptr, 0, iStatus, iLength)
...
----------------------------------------

Actually I got the answer from a co-worker
The problem was in:
------------------------------
TPtr8 ptr(iData->Des());
------------------------------
as soon as I changed

-------------------------------------------
iSocket.Send(ptr, 0, iStatus, iLength)
-------------------------------------------
to
-----------------------------------------------
iSocket.Send(*iData, 0, iStatus, iLength)
-----------------------------------------------
everything went well

Apparently "ptr" was temporary data and thus not suitable for asynchronius operations.
Cheers!