Send XMPP Message (Smack)

Well, the problem should be trivial, but I canโ€™t get to it.

I have two users A and B

Their JID for this example will be A @ 123 and B @ 123, where 123 is the IP address of the server.

I am sending a message from A-> B using the following code:

   chat = chatmanager.createChat(username,
   new MessageListener() {
      public void processMessage(Chat chat, Message message) {}});
   String sendUsername = username + "@123";
   Message msgObj = new Message(sendUsername, Message.Type.chat);
   msgObj.setBody(message);

   chat.sendMessage(msgObj);

I hardcoded the IP, so I'm 100% sure that I am attaching "@ 123" at the end of the alias, so there are no invalid JIDs.

So, A @ 123 sends msgObj to B @ 123. So I realized that XMPP messaging works. What you cannot send from A-> B, but should be A @ 123 โ†’ B @ 123.

However, my server seems to be thinking differently. He constantly informs me of the following error:

 2010.12.27 19:02:52 [org.jivesoftware.openfire.session.LocalOutgoingServerSession
 .createOutgoingSession(LocalOutgoingServerSession.java:258)] Error trying to 
 connect to remote server: A(DNS lookup: A:5269) 
 java.net.UnknownHostException: A 

In both lists A and B on the Openfire server, they have each other as a contact with the corresponding JID (username @ 123).

- ? .

Edit

Wireshark, XML, Openfire , , (A @123 A).

Wireshark XML:

\302\3469\223\341\3429\000\000\000\000\377\377

SSL, . , XML- SSL, ?

+3
2

, .

:

 chat = chatmanager.createChat(username, new MessageListener() {
            public void processMessage(Chat chat, Message message) {}
      });

" " IP. , "A" "A @123"

"sendUsername" " " "sendUsername" :)

.

+2

IP- , .

, OpenFire , IP- . " " , xmpp.domain IP-.

+1

Source: https://habr.com/ru/post/1782310/


All Articles