powered by Jive Software

XMPPConnection.getHost() broken?

I’‘m not quite understanding what is going on here. I spent several hours thinking my code was wrong and finally eventually tracked down the problem to be that getHost didn’'t do what I thought it did.

I would expect that if I am on a computer called “box-a” and i goto a server called “box-b” that doing a getHost() would return to me “box-b”. What is the purpose of having it tell me my own hostname? I can already find out my own hostname. What I can’‘t figure out is how to tell the hostname of the machine I’'m connected to.

This is done using smack 1.5.0 and smackx 1.5.0 (smack appears before smackx in the classpath). The code used to illustrate the point is

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

public class ConnectionInfo {

public static void main(String[] args) throws XMPPException {

XMPPConnection conn = new XMPPConnection(“shadow”, 5222);

conn.login(“lobbyowner”, “lobbyowner”, “stand alone app”);

System.out.printf("%s %s\n", conn.getHost(), conn.getPort());




If this is the intended behavior, could somebody tell me how to figure out the hostname and port of the machine I’'m connected to?

Oh and I guess the thing that I forgot to mention which may very well be the cause of all this is that I have 8 servers on 8 seperate machines. Each of those machines goes to an oracle database however for its information (including its domain). I am currently testing it from the machine that happens to be the actual machine with that matching domain name, however it still doesn’'t change that I need to know some way of figuring out the actual machine that it connected to.