powered by Jive Software

Packet listener? Help!

This is my message Code:

package Chat;

/*

  • Created on 07.05.2006
  • TODO To change the template for this generated file go to

  • Window - Preferences - Java - Code Style - Code Templates

*/

/**

  • @author Lance
  • TODO To change the template for this generated type comment go to

  • Window - Preferences - Java - Code Style - Code Templates

*/

import org.jivesoftware.*;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

public class Chat {

public static void send(String user, String pw){

XMPPConnection con;

try {

con = new XMPPConnection(“jabber.org”);

con.login(user, pw);

           con.createChat("m33p@jabber.org") 

.sendMessage(“lsfjhlkdhgkjdf”);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

/i

I created a textfield for PW and USER so don’'t worry ''bout that,

The first message is send without problems, if i try to send a second message…

Eclipse shows up this error:

stream:error (text)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:315)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:63)

I saw that there’'s a packet listener in the smack.dev kit.

But…how to use it? Do i really need it?

take care m33p

Hey man, not sure why you want to login everytime before you send a message. That is not necessary. MAke another methos to send message instead of chunking everything into one.