RSS

Java Networking: Enabling your app to access internet through a proxy server

28 Jun

So in my earlier blog post I made a web browser and all, and the first problem I encountered was getting it to connect to the internet. Why this is a problem is because I access the internet through a proxy server. Most institutions have proxies and can only access the internet at a particular port so its kind of nice to let them connect. Its just 3 lines of code:

System.getProperties().put("proxySet","true"); //Tells java that you'll be connecting through a proxy
System.getProperties().put("proxyHost","10.223.0.2"); // and the port the server is listening in
System.getProperties().put("proxyPort","3128"); //specifies the servers ip

 

Advertisements
 
Leave a comment

Posted by on June 28, 2012 in Code, Java

 

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: