aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Getting out of a proxy server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Getting out of a proxy server" Watch "Getting out of a proxy server" New topic
Author

Getting out of a proxy server

Guhan Ramanan
Greenhorn

Joined: Jun 29, 2000
Posts: 7
Hello!
I have a proxyserver called PROXYSERVER and that is connected to the Net.
I tried the following code and it gave me a UnknownHostException. How do i resolve it?
// Code follows
import java.io.*;
import java.net.*;
import java.util.*;
class InetTest
{
public static void main(String args[]) throws Exception
{
Properties prop=System.getProperties();
prop.put("Http.proxyHost","PROXYSERVER");
prop.put("http.proxyPort","80");
Properties prop1=System.getProperties();
System.setProperties(prop1);
System.out.println(prop1);


InetAddress Address=InetAddress.getLocalHost();
String abcd=Address.getHostAddress();
//String abcd = InetAddress.getHostName();

System.out.println(abcd);
Address = InetAddress.getByName("www.hotmail.com");
System.out.println(Address);
}
}
I get local host name and the property has been added but still there is the exception.
Plz help..
-guhan


<B> Guhan Ramanan </B><BR>Sun certified Programmer for Java2 Platform
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hi
Even I had the same problem earlier . But after installing the microsoft proxy client on to my system, the program worked perfectly without any problem .
Try installing the proxy client from ur server . Its a software that is available on the server . In case you are unable to undestand what is the funda behind the proxy client .Contact ur server administrator he will install it for u .

------------------
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting out of a proxy server