how to connect internet

M

moon

Hi Reader

Below java program work on Proxy server before. Now, Our compary change
using "Automatic configuration script" to connect internet. Now, I want to
know how to change the java program ?

the setup changed to ip address:8081/pixs.pac

/* Environment variable set to
* CLASSPATH=c:\j2sdk1.4.1_01\lib\classes.zip;c:\example;.
*
*/

import java.util.*;
import java.io.*;
import java.net.*;

public class eproxy_kgi {
public static void main(String[] args) {
Properties prop = System.getProperties();
String myproxy = "xx.xx.xx.xx";
prop.put("http.proxyHost",myproxy);
prop.put("http.proxyPort","8081/pixs.pac");
try {
// String Addr =
"http://www.kgieworld.com/kgi_csite/kgidata/indices/s_quote.asp?mnuMarket=HK
&stockcode=5&partner=";

String Addr = "http://www.kgieworld.com/kgi_csite/main.asp";
String outfile = "c:\\temp\\abc.html";

URL yahoo = new URL(Addr);
System.out.println("Conneting ... " + Addr);

BufferedReader in = new BufferedReader(new InputStreamReader
(yahoo.openStream()));
BufferedWriter out = new BufferedWriter(new FileWriter(outfile));

String inputLine;
System.out.println("Output to " + outfile);
while ((inputLine = in.readLine()) !=null) {
out.write(inputLine);
out.newLine();
}
in.close();
out.close();
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}
 
R

Roedy Green

Properties prop = System.getProperties();
String myproxy = "xx.xx.xx.xx";
prop.put("http.proxyHost",myproxy);
prop.put("http.proxyPort","8081/pixs.pac");

try just commenting out those lines. It has been a while since I
played with dialup.

You can just ask the user to make the connection first then start your
program.
 
E

ExGuardianReader

moon said:
Hi Reader

Below java program work on Proxy server before. Now, Our compary change
using "Automatic configuration script" to connect internet. Now, I want to
know how to change the java program ?

the setup changed to ip address:8081/pixs.pac

/* Environment variable set to
* CLASSPATH=c:\j2sdk1.4.1_01\lib\classes.zip;c:\example;.
*
*/

import java.util.*;
import java.io.*;
import java.net.*;

public class eproxy_kgi {
public static void main(String[] args) {
Properties prop = System.getProperties();
String myproxy = "xx.xx.xx.xx";
prop.put("http.proxyHost",myproxy);
prop.put("http.proxyPort","8081/pixs.pac");

Read the proxy.pac script into your browser and take a look at it. It
shold be easy to understand. It usually consists of a function which
returns the name of the proxy server depending on the URL. You can see
what proxy server name you need to code into your java, or how to make
the decision about which proxy server to use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top