Reputation: 4276
I have installed openfire server on my computer (name: duong2179-pc, static public IP: 20x.25x.xxx.xxx). I also installed Spark and registered 2 accounts: test1 and test2. I developed a small Desktop Java application using Smack.
I loged in test1 on Spark and test2 on my application, both accounts in following format: [email protected], then I got troubles: test1 (on Spark) can send message to test2 (the Java application) but test2 cannot send back. Here is the origin of the problem:
sendMessage(message, "[email protected]);
I tried to change a little bit, such as
sendMessage(message, "test1@duong2179-pc");
then it worked well.
So what is the different point here?
Please notice that, when I loged in Spark I used server as 20x.25x.xxx.xxx not duong2179-pc
Upvotes: 0
Views: 3353
Reputation: 24262
When you send an xmpp message, the JID (Jabber ID) of the receiver is made up of three parts, the user info (test1), the xmpp domain (duong2179-pc) and an optional resource.
[email protected]/resource
This domain, IS NOT, the hosts address, it is the xmpp domain as configured on your server.
It just so happens that the default domain when you install openfire, is the hostname of the machine that it is installed on. Thus the xmpp domain and the hostname just happen to be the same, which is why the second case worked, but not the first.
If you open the admin console on your server and change the domain name to something else, neither of the sample lines will work.
Upvotes: 1