[jdev] parsing xml (xmpp) with ruby

Michal 'vorner' Vaner vorner at ucw.cz
Mon Sep 29 11:09:01 CDT 2008


Hello

On Mon, Sep 29, 2008 at 11:44:52AM -0400, Eric Will wrote:
> My question is this: how often could this happen, TODAY? In all the  
> years I wrote IRC programs, I can't recall EVER getting a partial- 
> line, and in my two years of messing with XMPP, I can't recall EVER  
> getting a broken stanza. This should only really happen if the packets  
> get fragmented very badly, someone's on a really bad connection, or  
> the client is sending half a stanza at a time over TCP. I think that's  
> the client's problem. The worst thing that could happen is the client  
> gets booted and has to reconnect. I don't know if this possibility is  
> worth costing all that performance. How bad could it be if I chose to  
> simply ignore this and see what happens?

I can assure you these thinks happen in real life. I sometimes spend a
week with few other people and we _together_ have one gprs connection.
If some more traffic happens, the stanzas start getting generated faster
than the connection can send and they are put into packets one after
another, completely forgetting about the original boundaries. You do not
want to wait for end of stanza, you could wait tens of seconds. In these
conditions, I would not even log in with the way you want to do it.

Besides, you are not guaranteed every stanza would fit into usual-sized
ethernet packet (you can get 10k stanzas for example when
receiving/publishing vCard).

You probably should do some tricks like asynchronous sockets (read until
you run out of data, get error, return, once select tells you) or
threads.

-- 
I never finish anyth

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20080929/6c0991f5/attachment-0003.pgp>


More information about the JDev mailing list