Hi all,
I’m new in this community, I’m tryin to let one of examples work.
I already have Openfire configured and perfectly working, when I try to run this example below I receive the message on my second user (on pidgin client) and the sender automatic disconnect itself with no reason, I cannot send messages from my second user to the client running on eclipse (the example).
That’s the example:
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.*;
public class Connect2 {
public static void main(String [] args) {
System.out.println(“start”);
ConnectionConfiguration config = new ConnectionConfiguration(“MYSERVER”, 5222);
XMPPConnection con = new XMPPConnection(config);
try {
con.connect();
} catch(XMPPException e) {
System.out.println(“error connection”);
System.exit(1);
}
System.out.println(“connection ok”);
try {
con.login(“user1”, “password”);
} catch(XMPPException e) {
System.out.println("error login "+e.getMessage());
System.exit(1);
}
System.out.println(“login ok”);
try {
Chat chat = con.getChatManager().createChat(“pidginuser@server”, new MessageListener() {
public void processMessage(Chat chat, Message message) {
System.out.println("Received message: " + message);
}
});
chat.sendMessage(“I am bot!”);
} catch(XMPPException e) {
System.out.println(“error chat”);
System.exit(1);
}
}
}
Can anyone help me? Why my client on eclipse close itself and don’t let me receive messages from my pidgin client?
Thanks all!!