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());
conn.close();
}
}
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?