InetAddress.getByName on Android

前端 未结 4 1777
别跟我提以往
别跟我提以往 2020-12-11 17:53

I do a:

java.net.InetAddress serverAddr;
try {
    serverAddr = java.net.InetAddress.getByName(Server.SERVERNAME);
}
catch (java.net.UnknownHostException exc         


        
4条回答
  •  半阙折子戏
    2020-12-11 18:06

    Don't know if it was a typo, but you said you have:

    
    

    But it have to be:

    
    

    I tried getByName and it works fine.

    May be you fixed your permissions and switched from getByName to getAllByName at the same time? Just curious, if you can confirm that getByName still does not work for you?

提交回复
热议问题