0

hi im janaka priyadarshana

for get data frome a particuler URL I want to set may proxy. for that i want to create a proxy object with java. the following is the code segment.

import java.net.*;
import java.io.*;
import java.net.Proxy;


public class MyURLConnection {
    private URL myURL;
    private URLConnection myConnection;
    private String address;
    private Proxy myProxy;

    private void readURL(String address) {
        try {
            myURL = new URL(address);

            myProxy = new Proxy();

            myConnection = myURL.openConnection(myProxy);
        } catch (MalformedURLException ex) {
            System.out.print("can not create url object");
        } catch (IOException ex) {
            System.out.print("Can not open the connection");
        }

    }

to create a proxy object it is require a as following parameters.

Proxy

Proxy.Type type,
SocketAddress sa

for give these two parameters i dont know what they are?
i know only my proxy name and its port address.

please can anyone help me.

thank you.

Edited by pyTony: fixed formatting

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by jwenting
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.