To get the proxy address

Hi
Is there any api in jdk1.4 to get the proxy address..
Regards
Sharon

hi,
try with out execute webstart,
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import com.sun.java.browser.net.ProxyInfo;
import com.sun.java.browser.net.ProxyService;
public class MainTest {
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
//detect("http://www.myuniportal.com");
detect2();
public static void detect2() {
try {
System.setProperty("java.net.useSystemProxies","true");
List l = ProxySelector.getDefault().select(
new URI("http://www.yahoo.com/"));
for (Iterator iter = l.iterator(); iter.hasNext(); ) {
Proxy proxy = (Proxy) iter.next();
System.out.println("proxy type : " + proxy.type());
InetSocketAddress addr = (InetSocketAddress)
proxy.address();
if(addr == null) {
System.out.println("No Proxy");
} else {
System.out.println("proxy hostname : " +
addr.getHostName());
System.out.println("proxy port : " +
addr.getPort());
} catch (Exception e) {
e.printStackTrace();
public static void detect(String location)
String proxyHost;
int proxyPort;
try {
ProxyInfo info[] = ProxyService.getProxyInfo(new URL(location));
if(info != null && info.length>0)
proxyHost = info[0].getHost();
proxyPort = info[0].getPort();
System.out.println("PROXY = " + proxyHost + ":" + proxyPort);
}catch (Exception ex) {
System.err.println(
"could not retrieve proxy configuration, attempting direct connection." + ex);
}** code taken from tdanecito, in java.net forums

Similar Messages

  • Is there any possible ways to get the MAC address?

    Hi guys:
    I am writing servlets on the server side. Is there any possible ways to get the MAC address when a HTTP request come in? Thank you very much for any helps.
    all the best!

    It is usually impossible to get the MAC address of the maker of a HTTP request in any programming language or system.
    At best, you can get the MAC of the closest intervening router, firewall, whatever.
    Are you sure you mean the MAC address? MAC looks like this: 8:ab:f0:0:71:bb:90 (Ethernet), or 01-23-45-67-89-ab (Token Ring), etc, depending on your network type.
    In contrast, an IP address looks like this: 209.249.116.195. If you want the IP address, check out the javadoc for HttpServletRequest and ServletRequest. Caveat: load balancers, web caches, proxy servers, etc will mask the "true" peer's address. Don't do anything silly like try to use the IP address for security or authentication.

  • Getting the IP address of the client

    How do I get the IP address of the client that makes a request in the Internet?
    getRemoteAddr() cannot be used since the client may be from a proxyserver or an ISP provider ...
    Can I get some help on this?
    Thanks in advance
    Jai

    I think you cannot get the IP address of the client if he uses a proxy server.
    Hope to hear good news from others.
    Regards.
    Jeffrey

  • Getting the MAC address of the machine

    Is there any method to get the MAC address of machine in java.?????????????
    In our proxy server application we get the IP address of each client connected our proxy server.
    But as the IP addresses are dynamic , we can't trace the location of the machine whenever any client does malicious downloads.

    Thanks It works .
    The code is as follows .
    It works when the machine is connected to internet while throws a null pointer exception when not connected .
    import java.net.InetAddress;
    import java.net.NetworkInterface;
    import java.net.SocketException;
    import java.net.UnknownHostException;
    public class MacAddress {
    public static void main(String[] args) throws SocketException, UnknownHostException {
    try {          
    InetAddress address = InetAddress.getLocalHost();
    * Get NetworkInterface for the current host and then read the
    * hardware address.
    NetworkInterface ni = NetworkInterface.getByInetAddress(address);
    byte[] mac = ni.getHardwareAddress();
    * Extract each array of mac address and convert it to hexa with the
    * following format 08-00-27-DC-4A-9E.
    for (int i = 0; i < mac.length; i++) {
    System.out.format("%02X%s", mac, (i < mac.length - 1) ? "-" : "");
    // System.out.print(mac);
    } catch (UnknownHostException e) {
    e.printStackTrace();     
    } catch (SocketException e) {
    e.printStackTrace();

  • Whenever I update my iPhone software, it asks me to sign in to iCloud with an old email address.  My other devices all have the correct address.  How can I get the correct address for my iPhone?  The only Apple ID that works for logging in is my new one.

    Whenever I update my iPhone software, it asks me to sign in to iCloud with an old email address.  My other devices all have the correct address.  How can I get the correct address for my iPhone?  The only Apple ID that works for logging in is my new one.

    To change the iCloud ID you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iPhone (if you're using iOS 7), then sign back in with the ID you wish to use.  If you don't know the password for your old ID, or if it isn't accepted, go to https//appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Tap edit next to the primary email account, tap Edit, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone on your device, even though it prompts you for the password for your old account ID. Then go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https//appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • How can I get the MAC address of my Apple TV?

    How can I get the MAC address of my Apple TV? I currently do not have an HDMI device to connect it to, and the MAC is not listed on the box or the Apple TV itself.
    (to answer the obvious, I am trying to pair it with an iPad, and I need to register the Apple TV for the network so the two can see each other)

    As long as I know java doesn't have support to work on link-layer, only internet and transport layers. You may write simple native code. On windows, IP Helper functions, like SendARP allow you to pass an IP address and get the hardware address. You store the hardware address on your database/file and later, when that machine is off, you send a frame to the address you stored previous.
    [http://msdn.microsoft.com/en-us/library/aa366071(VS.85).aspx]
    I haven't seen it on Linux, but if you need help let me know I'll check the Linux API's too.

  • Can I get the IP address of my stolen iPad through find my iPad?

    Hi. My iPad was very recently stolen when my house was burglarized. I have find my iPad turned on and marked the device as lost. Earlier, the iPad was located and the general location was sent to me. Unfortunately, the person who stole it turned it back off as soon as they saw that it was remotely locked (this is a huge problem to me, as a remotely locked device shouldn't be able to be so easily switched off). I told the police where it was located, but it wasn't on long enough to give me an exact location. So, they will not issue a warrant because it could be in one of about 4-5 houses.
    Does anyone know of a way I can get the ip address that was used when the device reported it's location via find my iPad? If I have that, then we can get a warrant and get the police to look for it. It seems like this should be available, as the device was marked as lost under find my iPad. I just can't seem to find the info anywhere on the site.
    If you have any advice, please help.

    You don't need to know the remote IP if you have your PPP setup correctly. Check this site out.
    http://www.stokely.com/unix.serial.port.resources/index.html

  • How to get the Delivery address for PO

    I have a problem.
    I am working on a SAP Script , which is for PO(Zmedruck_po) , which is a copy of
    MEDRUCK.
    I am asked to print the delivery adress in a window .
    The scenario is like this .
    In ME23N , under item details , there is a tab called DELIVERY ADDRESS
    this has option to enter the adress details or a delivery number in the  address text box .
    If the address number is present i have to print that address , else i have to print the address which is entered in the delivery address tab.
    If the delivey address number is there i have no problem in printing it ,But if address number is not there ,I need to know how to get the delivery address,
    is it the plant address, company code address ... ?
    I debuged ,but could not find out.
    Can anyone help please .

    Hi,
    try using the below method:
    Goto TWLAD table with storage location (EKPO-LGORT) as key to get address number (ADDRNUMBER).  then goto ADRC table to get the address of the delivery
    Regards
    Shiva

  • How to get the Url(address) of Next Page in Sequence of Pages in OAF

    Dear All,
    My requirement is to get the next page Url dynamically .
    i have created 2 pages ,first page have button to navigate to the next page ,when i click on first page button ,
    i want to store the url of the next page in column of the database table.
    This is urgent requirement .
    Please suggest .
    Thanks
    Maheswara Raju

    > Is there any way to get the memory address of a
    variable (like int ,float and all) in java.
    No. Chances are excellent that there's a way to do what you want without needing the variable's address, however.
    ~

  • How to get the MAC address of the additional 10G NIC with ILO command line

    how to get the MAC address of the additional 10G NIC with ILO command line?
    thanks.
    This question was solved.
    View Solution.

    Hi Bruce,
    Out from what I can find on this network card is it not possible to get the mac address without a OS. I would recommend you to get/burn a Linux/Ubuntu live CD/DVD and run a Ifconfig in there.
    Hope it helps you.
    Best regards
    Zincas
    I work on behalf of HP

  • How to get the IP address of printer USB attached to Time Capsule?

    I'm trying to work a printing problem with my HP7310 Officejet and VMware's Fusion 2.0.3. I'm on Mac OS 10.5.5.
    One of the first diagnostic steps for Fusion is to ping the IP address printer. If I open the Print & Fax dialog from System Preferences I can see the name of my printer, let's say it's called "foo bar". I then open a bash terminal and type: ping "foo bar", but get an "unknown host" message.
    I can ping the Time Capsule itself by getting the IP address from Airport Utility. The printer "foo bar" shows properly in the Airport Utility Printers dialog.
    Anyone have any suggestions?

    If you open AirPort Utility > Manual Setup > Advanced > Logs & Statistics > DHCP clients, a list of the devices will be displayed with their IP addresses. Make note of these.
    You will have to get the IP for your printer by process of elimination. Go to
    System Preferences > Network to see your ethernet and wireless connections and associated IPs. You should be able to narrow the list down to identify your printer.

  • Can I get the Mac address in Audit logs of Active directory server for the user's machine which connect to the network/Domain

    Hello All,
    I am trying to get the information of all the user's who connect to our Domain network by signing in using the domain account. For this I am using the Windows audit group policies ( I am not sure of there is any other way). I can see when the user tries
    to login to the network there is a audit event created on the AD/DC server. I can see the Kerberos authentication and logon/logoff events in the audit events under event viewer.  
              However the info which is being populated in these events include :- Hostname, IP address, Username and so on... But I can't see the MAC address of the user machine/system. Is there any way I can
    get the Mac address of the endpoint system as its one of the important criteria for our project.
    Any inputs on this would be appreciated, incase if there is any other way other than group policies please suggest.
    Thanks,
    Kavish

    > include :- Hostname, IP address, Username and so on... But I can't see
    > the MAC address of the user machine/system. Is there any way I can get
    > the Mac address of the endpoint system as its one of the important
    > criteria for our project.
    If you use DHCP, you can query the DHCP server. There's no builtin
    method to get the MAC address directly.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • How to get the MAC address of a PXI in a dll

    Hi,
    I am looking for a way to get the MAC address of a PXI RT controller. I know that there is a VI to do this, but I am looking for a solution for a dll (C-Code).
    I use the "Call library node" to call this dll and want to make sure that it is only used on a specific PXI.
    Since the VI provides the functionality, I am wondering if it is also available to be called from C-Code?
    Thank you,
    Christian
    Solved!
    Go to Solution.

    ChristianEC wrote:
    Hi,
    I am looking for a way to get the MAC address of a PXI RT controller. I know that there is a VI to do this, but I am looking for a solution for a dll (C-Code).
    I use the "Call library node" to call this dll and want to make sure that it is only used on a specific PXI.
    Since the VI provides the functionality, I am wondering if it is also available to be called from C-Code?
    Thank you,
    Christian
    If it is available in LabVIEW it is probably available in CVI, which you could then build into a DLL (if there isn't one available already).
    CLA, LabVIEW Versions 2010-2013

  • How to get the MAC address of  other hosts in local net

    1. Is there any kerner or user function to get the MAC address of other hosts in local net?
    2. ire_route_lookup() can only lookup MAC in routing table(arp -a),Is there any way to enable it to find out all MAC of hosts in the local net?
    Best Regards
    Hann

    ChristianEC wrote:
    Hi,
    I am looking for a way to get the MAC address of a PXI RT controller. I know that there is a VI to do this, but I am looking for a solution for a dll (C-Code).
    I use the "Call library node" to call this dll and want to make sure that it is only used on a specific PXI.
    Since the VI provides the functionality, I am wondering if it is also available to be called from C-Code?
    Thank you,
    Christian
    If it is available in LabVIEW it is probably available in CVI, which you could then build into a DLL (if there isn't one available already).
    CLA, LabVIEW Versions 2010-2013

  • How to get the IP address of smtp server?

    For A record in DNS, we can use Java API InetAddress.getHostAddress() to get the IP address.
    But for mx record, how to get the IPaddress?

    If you know the hostname of the MX record (eg. mail.somehost.com), you can still use the InetAddress.getByName(hostname).getAddress()
    If you don't know the specific host name you can do a DNS lookup directly:
            String host="somehost.com";
            DirContext ictx = new InitialDirContext();
            Attributes attrs = ictx.getAttributes("dns:/" + host, new String[]{"MX"});This will give you a javax.naming.directory.Attributes object from which you can...
    Attribute att = attrs.get ("MX");This will give you all the MX records for the domain. To get the IP address of the MX hosts, you need to parse the record String returned. Usually something like:
    somehost.com       MX preference = 10, mail exchanger = mail.somehost.comParse out the mail.somehost.com and use:
        String mailhost = <Parse MX record here>
        InetAddress host = InetAddress.getByName(mailhost);

Maybe you are looking for

  • How do you use the windows User32.dll Library functions to read variables from other applications that are running

    I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with

  • OS X install failure, need suggestions

    I just sold my mac mini on ebay, and I went to wipe my info and do a fresh install of Leopard. However, after formatting my drive with the zero writing security setting, the install fails. I've tried to install about 5 times, doing a fresh install. I

  • ITunes download error, tap to retry

    I purchased some songs from iTunes, and all except 3 downloaded just fine. 3 songs keep coming up "Download error, tap to retry". I have tried numerous times to retry the download, but keep getting the error message. I cannot select and delete the do

  • Plz help my iPod shuffle!!

    I am sorry to post here becoz no response in iPod shuffle 1st area. My device is an iPod shuffle 1st. My OS is Windows XP SP3. My iPod's indicator light is green and orange alternately and I cannot hear a sound with my earphone. If I hold the play bu

  • Netcfg laptop wireless - "DHCP ip lease attempt failed"??

    hey folks. just loaded arch onto a toshiba laptop. in the process of configuring wireless, i followed the netcfg config instructions in the wiki. It worked fine the first time, but when I rebooted every subsequent time i tried to connect I get the "D