I was trying to determine if a connection exists by using the connection.isConnected() method. Not sure if this is even the correct way to test if connected? Any advice is appreciated!
public void getConnection(String user, String pwd) throws XMPPException
{
conn = new XMPPConnection(HOST,PORT);
if(conn.isConnected()){System.out.println(“CONNECTED FROM WEBCONNECT”);}
else{
System.out.println(“NOT CONNECTED FROM WEB CONNECT”);
conn.DEBUG_ENABLED = true;
conn.login(user,pwd);
}
}
/code
Basically what I am trying to do is to determine if the user is already connected and if not, create a connection.
I wasnt sure that it would work properly. I was creating the conn object and then testing to see if it was connected. Wasnt sure where the connection is actually made: