On Wed Nov  1 17:07:11 2006, Michal 'vorner' Vaner wrote:
On Wed, Nov 01, 2006 at 06:07:39PM +0100, Tobias Markmann wrote:
> Isn't that a TCP problem since that can happen to any protocol which is
> based to TCP?

Well, it is partly implementation problem, many OSes (as I heard) are able to tell you how much was already delivered and if you remember what
part of data was what stanza, you can resend it after reconnection.

But that is bit more work, of course, and alot more data.

No OS can tell you what's been delivered, but some might be able to tell you what hasn't been sent, and what hasn't been acknowledged. I looked for how to do this on Linux, which usually provides the richest API to the network layer, but I couldn't find anything to tell me either.

But this isn't quite the same thing anyway - you want to know what stanzas have been accepted - what happens if the ACKs get lost, or the server dies?

Consider ESMTP, which has got data level acknowledgement. There's a long-known problem whereby after DATA (and these days, BDAT and BURL), there's a chance that you'll lose the connection before you get the 2xx acknowledgement from the server. This is on the increase again, partly due to the preference for protocol-level rejections instead of DSNs, partly due to the marked increase in usage of ESMTP over things like GPRS.

It's important to note that this specifically is about hop-by-hop, and not end-to-end, which are different problems entirely. Finding out if the guy you're talking to is still connected is quite easy, just send an IQ (in principle *any* IQ), and you'll see.

Hop-by-hop tests are quite easy, too, but there's a gotcha - when they fail, you want to know which stanzas you need to resend. And XMPP does not provide any mechanism for that, and nor do pings.

My last suggestion - adding a sequence attribute to stanzas - didn't seem to impress most people, partly because it requires servers to rewrite stanzas between hops.

If instead the sender appends a distinct stanza (which could be an iq, or could be something else) to every TCP segment sent, which itself contains a sequence, then that can be used as the restart token with almost precisely the same effect, and requires no rewriting of stanzas.

So, the sender appends, for instance, <iq type='set' id='ping123'><ping xmlns='urn:xmpp:ping' sent='1' recv='47'/></iq> to each send() call's payload, and the receiver can then note this simply, and respond with an iq reply when it suits it, which also contains sent and recv sequence counts.

Loosely, you'd add that to the end of each TCP packet, in practise about every 1.5k or at the end of each send() should be quite safe.

Dave.
--
Dave Cridland - mailto:[EMAIL PROTECTED] - xmpp:[EMAIL PROTECTED]
 - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
 - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade

Reply via email to