Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to connect internet

Reply
Thread Tools

how to connect internet

 
 
moon
Guest
Posts: n/a
 
      08-12-2005
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:\exam ple;.
*
*/

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();
}
}
}


 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      08-12-2005
On Fri, 12 Aug 2005 09:36:41 +0800, "moon" <moon_ils->
wrote or quoted :

> 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.
 
Reply With Quote
 
 
 
 
ExGuardianReader
Guest
Posts: n/a
 
      08-14-2005
moon wrote:
> 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:\exam ple;.
> *
> */
>
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer does not connect to the internet dimension89 Computer Support 1 10-21-2006 02:03 AM
Can connect to wireless but can not connect to internet Lucy Wireless Networking 2 09-23-2006 11:47 AM
Can connect to wireless but can not connect to internet Lucy Wireless Networking 0 09-22-2006 11:52 AM
Can connect to wireless but can not connect to internet Lucy Wireless Networking 0 09-22-2006 11:03 AM
Aliant TV - Trying to connect a wireless router, not able to connect to Internet rich irving Computer Support 5 01-11-2006 06:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57