[jdev] Multiple IQ stanzas in one "socket read"

Dave Cridland dave at cridland.net
Wed Aug 21 21:15:23 UTC 2013


If we're going to be really pedantic about this - and obviously I'm going
to be...

On Tue, Aug 20, 2013 at 8:46 PM, Peter Mount <peter at retep.org.uk> wrote:

> Yes it is possible as it's an xml stream not a packet based protocol.
>
First point of pedantry is that XMPP is a packet-switched network layer.
Just that its packets (stanzas and top-level elements) don't correlate to
TCP packets. But I know what you meant. :-)

> A socket read simply means you have data available to be read.
>
> So in this instance the server had two stanzas available and they got sent
> together.
>
Maybe... Or maybe not. Even if they'd been sent in two (or more) different
TCP packets, read() might have returned the data all at once. There's no
correlation implied between TCP packets and read() (or recv()), either.

> The opposite is possible. You could have a stanza that's too large so it
> takes multiple reads to receive the stanza.
>  On 20 Aug 2013 20:41, "Bradley Stone" <bvstone at bvstools.com> wrote:
>
>> Hi, all.
>>
>> Quick question here.  I just ran into a situation where on a single read
>> from a socket my jabber application received two stanzas.   One was an IQ
>> (ping) and the second was a presence.
>>
>> Example:
>>
>> <iq from='jabber.org' to='user1' type='get' id='ping'><ping
>> xmlns='urn:xmpp:ping'/></iq><presence from='user2' to='user1'
>> type='unavailable'/>
>>
>> I hadn't programmed for this and now am making the appropriate changes,
>> but I have a couple questions since it appears to be normal (but rare) to
>> include multiple stanzas on one socket write on the server side.
>>
>> 1.  Can multiple IQ stanzas be sent at once?
>> 2.  Can multiple presence or message stanzas be sent at once?
>>
>> Thanks.. let me know if this isn't clear.  :)
>>
>> Brad
>>
>> _______________________________________________
>> JDev mailing list
>> Info: http://mail.jabber.org/mailman/listinfo/jdev
>> Unsubscribe: JDev-unsubscribe at jabber.org
>> _______________________________________________
>>
>>
> _______________________________________________
> JDev mailing list
> Info: http://mail.jabber.org/mailman/listinfo/jdev
> Unsubscribe: JDev-unsubscribe at jabber.org
> _______________________________________________
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20130821/31abcf33/attachment.html>


More information about the JDev mailing list