powered by Jive Software

Cannot send message between openfire et smack

Hello,

I am trying to send a message between the user sender1 et the user listener 1, I have tried to follow the documentation and creating this code:


try
{

ConnectionConfiguration config2 = new ConnectionConfiguration(“127.0.0.1”, 5222);
// Create a connection to the igniterealtime.org XMPP server.
XMPPConnection con = new XMPPConnection(config2);
// Connect to the server

con.connect();

// Most servers require you to login before performing other tasks.
con.login(“sender1”, “a”);

// Start a new conversation with John Doe and send him a message.
Chat chat = con.getChatManager().createChat(“listener1”, new org.jivesoftware.smack.MessageListener() {

             public void processMessage(Chat chat, Message message) {
                 // Print out any messages we get back to standard out.
                 System.out.println("Received message: " + message);
             }
         });

chat.sendMessage(“Howdy!”);

// Disconnect from the server
con.disconnect();

}
catch(Exception e)
{
System.out.println("error : " + e.toString());
}


The connection on openfire is good but my message is never displayed and I have no errors.

Can someone tell me what I have done wrong?

Thank you very much.