Using company DNS

27 views
Skip to first unread message

sr

unread,
May 21, 2013, 3:00:13 AM5/21/13
to java...@googlegroups.com
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)

    try {
        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!
Reply all
Reply to author
Forward
0 new messages