powered by Jive Software

What do people use to keep a connection alive?

Hi, all;

So, I have this bot that should be waiting for a package… the way I know how to keep the connection open is the while(true){} line, but it eats up all my processing power while it’'s on.

So, what do you guys use to “stay online” waiting (indefinitely) for a package to arrive?

Thanks,

Leo

PacketCollectorS. See XMPPConnection.createPacketCollector (or something similar) for more information. They’‘re used everywhere in Smack, so it won’'t be hard to come with an example.

If you don’'t want to block the thread until the collector returns your packet, then see how to add a PacketListener.