[jdev] Using JSO for component development
Christian Cantrell
christiancantrell at mac.com
Thu May 18 20:16:51 CDT 2006
I'm using JSO to build a component, and I'm finding it more than a
little confusing. I've posted to the JSO list, but it's pretty
quiet, so I thought I'd try my luck here.
Using JSO, I'm able to connect to my server, listen for specific
packets, and return packets successfully. The part I don't
understand is how you continuously listen for packets. In all the
example code I've found, the authors have set up an infinite loop
inside of which they call Stream.process() to process new incoming
packets, and also keep checking a Queue for new packets to send out.
This technique works fine, but it seems odd to me, and is quite
resource intensive on my development machine. Can someone explain:
1. Why is it done this way?
2. Is there another way to do it? It seems that I should simply be
able to call a method that blocks until the packets I need come in
rather than having to process packets in a tight infinite loop.
I'm also wondering if anyone can recommend any other Java XMPP
libraries I can use to build an external XMPP component if I can't
get JSO to work like I want it to.
Thanks,
Christian
More information about the JDev
mailing list