powered by Jive Software

Method processPacket called on its own?

The documentation of *PacketListener *http://www.igniterealtime.org/builds/smack/docs/3.2.2/javadoc/org/jivesoftware/s mack/PacketListener.html

says

“every time a new packet is found, the processPacket(Packet) method will be called.”

But this is not so ! I have registered a packet listener like :

PacketListener pListener = new PacketListener() {

@Override

public void processPacket(Packet packet) {

System.out.println(“Inside process packet”);

}

};

PacketFilter pFilter = new PacketFilter() {

@Override

public boolean accept(Packet packet) {

return true;

}

};

ofConnection.addPacketListener(pListener, pFilter);

and after a certain inerval the statement : ***Inside process packet ***gets printed when I haven’t sent or received a packet ! What could be the reason for this ?

How do you verify that no packet was received?

BTW, packet listeners added with Connection.addPacketListener are only called for incoming packets (SMACK-464).

How do I verify ! I created a new user and logged him…Who would have sent him a packet ! ?

A Packet can be more then just a Message. XMPP exchanges a bunch of Packets while an connection is established and especially after the login. Enable Smack.DEBUG and see for your self.

Okay ! What kind of messages are exchanged ?

Run with the vm arg -Dsmack.debugEnabled=true

This will display a window with all the messages being sent/received.**
**