Sending messages

Hi there!

I’'m having some problems in order to send messages to another computer.

In the code below, I connect in the Jive server as admin user. It works since

if I change the password, it does not connect.

XMPPConnection connection = new XMPPConnection(“localhost”, 5222);

if (connection.isConnected()) {

connection.login(“admin”, “123”);

}

As I said before, my problem is about send messages.

In the other machine, I have a user “bizonhex” connected.

I have the code below in order to send messages to “bizonhex” user.

Chat chat = connection.createChat(“bizonhex”);

chat.sendMessage(“Hi Bizonhex! How are you?”);

The problem is: how can I get this message in the other computer used by “bizonhex”?

I’'ve tried so many times using System.out.println… but I got only null messages!

Have I to create another Chat object with “admin” in the other computer (bizonhex)?

Oi Márcio,

So this is more a Smack question rather than a JM question.

When creating a chat make sure to provide the bare JID (or full JID) of the user. That means that the parameter should be of the form "johndoe@server.com". Smack has many test cases so you can look at ChatTest, MessageTest or any other test case that is sending the message #createChat to learn how to initiate and have a chat with other users.

Regards,

– Gato

Hi Dombiak!

Yes. You are right about the location of the question!

if I change the password to 1234 for instance, it does not connect. Even with this, will I have problems about the incomplete username (without the email)?

I’'m going to take a look at the Smack unit tests!

Thanks!

Message was edited by:

marcio

Message was edited by:

marcio