Reputation: 1662
I am getting the exception java.net.UnknowHostException:http://arbitrary-hero.dyndns.org/. I am attempting to connect to the address with a android client application I have made.
I have two computers one is running ubuntu 10.10 and the other is running windows 7. When I go to www.ipchicken.com on the windows 7 computer to check my ip I get 71.72.220.109 when I do a ifconfig from the command line on my linux machine I get 71.67.105.9. The 71.72.220.109 goes to my server application on the windows 7 computer the 71.67.105.9 and the address arbitrary-hero.dyndns.org goes to the apache server on my ubuntu 10.10 machine. The computers are in the same house using the same network and I dont understand why they have those different addresses. Also I am trying to get them to both use the URL.
String webserver = "71.67.105.9"; //does not work
String everythingelseinthehouse = "71.72.220.109"; //works
String weburl = "http://arbitrary-hero.dyndns.org/"; // does not work
Socket sock = new Socket (weburl , 13267);
//Socket sock = new Socket (address_everythingelse , 13267);
//Socket sock = new Socket (address_room , 13267);
This is where I declare my socket, sorry about the extra code but I have tried all possible combinations to make this work.
If you would like more code from me to help me solve this problem please ask I would be very happy to resolve this issue.
Upvotes: 1
Views: 390
Reputation: 84229
URL is not a host name, use InetAddress.getByName("something.dyndns.org")
instead.
Other stuff about chickens is totally not clear in the question :)
... when I do a ifconfig from the command line on my linux machine I get 71.67.105.9 ...
This tells me that your Linux box is either statically configured with this IP, or your router is setup to treat wired connections differently.
Upvotes: 1
Reputation: 117665
You need to add this premission to AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
Also, you need to use InetAddress
for using the domain name instead of the IP address:
Socket sock = new Socket(InetAddress.getByName(weburl) , 13267);
Upvotes: 1