Thanks for the answer. Then, based on your what you said, getByName() accesses only FQDNs?
As I found a lot of trouble in making the connection this way, I bound the server's MAC Address with an IP in the router configurations (which seems now the obvious solution). On 1 jun, 14:41, Mark Murphy <[email protected]> wrote: > "server-PC" is not a valid domain name. getByName() uses DNS, as far as I > know. > > > > > > > > > > On Tue, May 31, 2011 at 4:59 PM, Luiz <[email protected]> wrote: > > Hello everyone. > > > I'm trying to connect with a computer (face it as a "server", I just > > have to access a database) in my app, based on the computer's name. It > > works fine with the IP, but I truly need to establish this connection > > based in the hostname (the IP is not guaranteed to be static). The > > computer is on windows 7. > > > This line of code keeps giving me an UnknownHostException > >>>>>>> String ip = InetAddress.getByName("server-PC").getHostAddress(); > > > That's where the weird stuff begins: it works perfectly if put > > "www.google.com" instead of "server-PC". It also works if I try to get > > the IP from a random non-android project in another computer in the > > same local network. > > > I believe it's important to highlight the fact that I don't need a > > connection with the Internet, just with my "local server", and that > > I'm running my application in a real device, not in a emulator. > > > Thanks in advance, > > Luiz > > > p.s.: sorry if something is not fully comprehensible because of my > > english. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

