RSocket::Send() question
| Mon, 2006-12-11 11:46 | |
|
Hi Symbian geeks,
I have a question for you: when the asynchronous method RSocket::Send() completes for a TCP/IP socket, where do the data to be sent reside with guarantee? Does the completion of the Send() method mean that a) ALL of the data were succesfully pushed to the local TCP/IP stack or b) that ALL of the data were succesfully received by the remote TCP/IP stack? I believe that the second is true but I need an answer from some expert to be 100% sure. If the first is true it means that to make sure that the data have been succesfully received by the remote, some kind of acknowledgment mechanism is needed on the application layer. Thanks in advance, George |
|






Forum posts: 100
Which means, the when you close the TCP socket, it will still stay around and try to transfer the unsent data (if any left). Application writer has be aware that
- with simple "Open - send data - Close" application cannot be 100% certain that all data was eventually transmitted. For that, you always need some application level protocol that acknowledges the receipt of file.
- some information can be got by doing Shutdown (ENormal or EStopOutput) before the Close. The OK completion at least signals that all data has been received by remote TCP protocol engine.
- if your protocol is like HTTP: send request and wait for reply, and the reply does not come. In such case, ALWAYS USE Shutdown EImmediate before closing. Otherwise the TCP machinery will potentially attempt deliver the request and orderly shutdown for several minutes!
Forum posts: 131
Forum posts: 100
There is actually obscure ioctl that is supposed to do exactly that:
My advise for using Shutdown EImmediate for any stuck sockets still stands.
TSockXfrLength just tells how much data from your send was actually accepted into the protocol buffers (at this point I don't know exactly the situation when XfrLenth would be different from the length of aDesC8).
Forum posts: 131
Are you sure? Would that mean that documentation is not correct?
Forum posts: 7
So if Write() completes when the last packet is received & acknowledged by the remote TCP/IP stack then it makes me happy.
Else if there is no such guarantee I have to implement some kind of acknowledgment mechanism in the application layer to avoid cases where Write() may have complete with KErrNone but not all of the packets have been yet received by the remote host (e.g. connection breaks right after).
Also, my protocol is message-exchange based and not a request-reply. So, after a host sends a message to another it doesn't wait for a reply, it just wants to know if it eventually received the whole message. So I cannot use the Shutdown() method.
I know that TCP/IP is a reliable protocol but is this reliability transfered to the application level?
Thanks a lot,
George
Forum posts: 1
what's the method to overcome this problem?
How to garantee that the pckg is received by the remote host?