Java code to connect through Proxy!

For Normal Java Applications, I have successfully connected through Proxy using the method specified in this link
ProxyAuthentication helper class, Code:


package proxytester;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

class ProxyAuthenticator extends Authenticator {

private String user, password;

public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}

protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password.toCharArray());
}

}


Code:

package proxytester;

import java.io.IOException;
import java.net.Authenticator;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;


public class Main {

public static void main(String[] args) {
Authenticator.setDefault(new ProxyAuthenticator("YOUR USER NAME", "YOUR PASSWORD"));
System.setProperty("http.proxyHost", "172.16.184.5");
System.setProperty("http.proxyPort", "80");

try {
URL yahoo = new URL("http://www.yahoo.com/");
URLConnection yahooConnection = yahoo.openConnection();
yahooConnection.connect();

System.out.println("Content: "+yahooConnection.getContentType());
} catch (MalformedURLException e) { // new URL() failed
System.out.println("Exception"+e);

}catch (IOException e) { // openConnection() failed
System.out.println("Exception"+e);
}

System.out.println("ok");
}
}

Load Balancing

Load-Balancing happens in many ways, 1. DNS/IP based load balancing 2. Using Hardware based Load Balancer 3. Using Software based Load Balancing Server 4. May be Clustering too.. The first method is very primitive, In this approach you register multiple IP addresses to the same Domain name in the DNS server, and according to the order specified for each name resolution request the IP is returned by the DNS server in that order. Using this approach, it may not be very effective but it is very simple to implement and there will be nothing to manage. The problem in this approach is it's not 'fault-tolerant', because if one of the servers which are specified are down, updating the same in DNS is not immediate as the information may be cached in several locations. Using HW/SW based load balancers, each has it's Pro's and con's, In general, H/W based load balancers are highly efficient as they are specialty devices designed for this task. But, the problem is there will be limited set of features, and it will be hard if not impossible to update the features which are implemented, the maximum one can do is to update the firmware, that too if that facility is provided. Using s/w based load balancing server, can have huge number of features incorporated in them like packet filters, firewalls etc and updating them will be pretty straight forward. But the problem with these is that, those are normal servers / PC's and are not that efficient as their H/w based cousins. There is another different approach of Load balancing, 'Geographic based load balancing'. Here, depending on the client IP the request is routed to the nearest server. Using this they aim to reduce the physical travel time/hops for the data packets. There is another form of load balancing called clustering, it may not be primary candidate for load balancing but the end result is high availability and load balancing. Here, if I think they use vendor specific protocols when they implement the clusters.... Implementing a load balancing H/w or S/w is not a small task, there are lot of issues like user session handling, fault-tolerance, scaling-up or down of available servers. etc... I think I have provided you with basic info... you can research and find out more...

Remote PC Management and access

Some years ago... during the Pentium 3 era.... I had one project plan, don't know if it is feasible today... Yeah!! things that were possible earlier are not possible (atleast as simple as earlier) now I thought of creating a 'Remote PC Management and Access Tool' The idea was simple, 1. During those days, we used to connect to the internet using 'Telephone Modems', 2. ATX powered Boards and Cabinet The system had various BIOS settings, (though the bios options and settings we strictly manufacturer/chipset dependent). One that really really impressed me was, 'Power Settings'. It had the following settings, apart from other settings 1. Power-ON on KeyBoard 2. Power-ON on Mouse 3. Power-ON on Password (cool) 4. Power-ON on MODEM 5. Power-ON on LAN I am not speaking about 'Wake-Up' options, the above are the real deal they are 'Power-up' options. I have tested one,two and three options they were really amazing. Using those settings, you simple plug-in the power cord in the mains, and just click a key on the key board or move the mouse a bit and voila, the system just boots up. My Idea was to use the 4th option for this project, Power-On on Modem. I had an internal modem, which I used not only to access internet but also to make my system as an "Answering Machine". If I get a call to the phone line which is attached to the modem, the Answering Machine software will play a prerecorded voice and Record the callers message..ha! Now, coming back when I tried to Power up my system using the Internal Modem, it didn't work... on scouring of manuals and internet didnt help much, but there was mention of a special cable that connects to pins of Modem to the Motherboard, guess its for power to help the modem to be active, when the PC was switched off(In those days everything was on PCI Cards, nothing was integrated into motherboards like today.) Anywayz, and later also found out that, Some External modems were capable of powering up the systems as they have external power connections. So, My Idea was this: 1. Connect the Phone line to a 'Suitable' Modem. 2. Configure BIOS, to POWER-ON on Modem. 2. Create a Server Application, that is similar to the answering machine, which can respond to the user's key codes. The DTMF tones which you hear when you press the keys on 'tone' phone. 3. The server application will be registered as a start up application. 4. The server application acts as an FTP server which can be used to transfer the local files. 5. If possible try to invoke Remote PC server too. 6. On receiving the Key code, Switch off the system using a 'Dos Command' to switch off the system. Now, when I look at the systems these days 'The Centreno Duos''... there are no facilities like POWER-ON On Keyboard,modem etc.. where did they go The only bios settings I can find is for Configuring of 'Boot Sequence' Huh!! May be my chipset doesn't have that feature. If any one of you have that feature on your latest motherboards let me know. I really, wanted that functionality which was not offered by any product because, while I was on vacation, I suddenly wanted an important file from my personal PC. But there will be no one at the PC to ask them to transfer the file. And I couldn't afford to Keep my PC powered on for months together. I just want to verify any faults with my idea. And.. do you know any better ways to achieve my objective... I know one solution would be to upload all files to online storage sites, or servers and access from any where around the world 24X7.