URL ftp UnknownHostException ip-address
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Franky_Leeuwerck
Posted On:   Wednesday, March 20, 2002 04:33 AM

Hello everybody, After creating a URL object as : url = new URL("ftp://"+myLogin+":"+myPassw+"@"+myHostWithDomaineName+"/"+myFile); I can succesfully ftp a file from a server. However, using the ip-address instead of 'myHostWithDomainName' leads to a java.net.UnknownHostException. If I use both url's in a browser, then there is no problem at all. Why is this different with the URL class in Java ? Or does someone know a solution for this approach ? Thanks in advance Franky    More>>

Hello everybody,


After creating a URL object as :


url = new
URL("ftp://"+myLogin+":"+myPassw+"@"+myHostWithDomaineName+"/"+myFile);


I can succesfully ftp a file from a server.


However, using the ip-address instead of 'myHostWithDomainName' leads to a
java.net.UnknownHostException.


If I use both url's in a browser, then there is no problem at all. Why is
this different with the URL class in Java ?
Or does someone know a solution for this approach ?


Thanks in advance


Franky

   <<Less

URL ftp with ipaddress works fine

Posted By:   Franky_Leeuwerck  
Posted On:   Wednesday, March 20, 2002 05:29 AM

The url formed with the IP address was wrong :

ftp:://user:passw@777.777.777.777xxxx/filename


I retrieved the ipaddress string from a datasource, but it was not trimmed still containing spaces (xxxx).


Solution was to trim() the ipaddress.


Everything works fine now.


Franky
About | Sitemap | Contact