Here's some code from one of my applets that sends a request to a server for a file and reads the response:
URL u = null;
BufferedReader in;
.....
// We're in an applet - go to server for the file
// u = new URL(getCodeBase() + CGI_DIR + "/GetFile.pl?" + fn);
u = new URL(getCodeBase() + fn + (addSfx == null ? "" : addSfx)); // do HTTP GET directly
URLConnection uc = u.openConnection();
in = new BufferedReader(new InputStreamReader(
uc.getInputStream()));
The applet can only connect to the server it came from. In the above that address is given by getCodeBase().
It is possible to give an applet permission to connect via the policytool program. It creates an entry in the .java.policy file giving permissions for connect and resolve.
Also it might be possible by signing the jar file the applet is in.