[jdev] Re: XMPP Ping method?

Magnus Henoch mange at freemail.hu
Wed Nov 1 13:45:26 CST 2006


"Michal 'vorner' Vaner" <michal.vaner at kdemail.net> writes:

> 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.

I'm in no way an expert in network programming, so what I'm about to
write might qualify as disinformation; please write corrections or
completions.

We want to know if the remote side has ACKed receipt of all the bytes
in a stanza.  In Linux, there is a way to get the size of the TCP send
queue:
http://mail.jabber.org/pipermail/standards-jig/2003-December/004570.html
But it seems to me that using that method would be cumbersome:

1. Send stanza A to connection.  Save copy of A and size(A).
2. Prepare to send stanza B.  If send queue is 0, forget A and goto 1.
   Else save B and size(B), and increase size(A) with size(B).
3. If send queue size is less than (the modified) size(A), consider A
   to be acked.  Likewise for B.
4. If connection fails, queue or bounce all stanzas sent but not
   acked.

Or something like that.  I probably got it wrong somewhere, and I
would probably make more errors if I tried to convert that into code.

So it would be nice if sending a piece of data returned the sequence
number of the last byte sent.  Then you could just compare it to the
sequence number of the last byte ACKed, and then you immediately know
if the stanza was received.

Thus, we should try to convince makers of socket APIs to include
functions to do just that.  Or did I miss anything?

-- 
Magnus
JID: legoscia at jabber.cd.chalmers.se




More information about the JDev mailing list