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.

see the API docs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.