Hey All,
when I create a connection using automatic DNS ("0.0.0.0"), I've NO problem:
If I use the company suggested DNS, i get the exception "Could not resolve hostname", and if after this exception I retry with automatic DNS, I can't connect and get the same exception.
My question is: can I retry a "Connector.open" twice with another DNS? Why my code not work?
1) It's OK:
try {
Connector.open( "socket://"+host+":"+port+";"+"bearer_type=gprs;access_point="+apn+";username="+uname+";password"+upwd+";timeout=0;");
}
catch( Exception e ) {
error=1;
}
2) It's NOT OK (not work)
Connector.open( "socket://"+host+":"+port+";"+"bearer_type=gprs;access_point="+apn+";username="+uname+";password"+upwd+";timeout=0;dns="+dns+";");
error = 0;
}
catch( Exception e ) {
error=1;
}
if( error == 1 )
{
try {
Connector.open( "socket://"+host+":"+port+";"+"bearer_type=gprs;access_point="+apn+";username="+uname+";password"+upwd+";timeout=0;"); // This call generate exception "Could not resolve hostname"
}
catch( Exception e ) {
error=1;
}
}
Thanks!