Getting the IP Address/host ID of a unix machine

Hi,
In my java program I am using this code to get the IP Address of a windows machine.
InetAddress inetAdd = InetAddress.getLocalHost();
String host_Name_IP = inetAdd.toString();I want to know if the same thing works in the unix machine also. If no pls tell me how to obtain the same in unix.
Thanks

then y is it returning null when I execute it on a
unix machineWorks on my Linux FC4!

Similar Messages

  • 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 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.

  • 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);

  • How to get the ip address of ur customers

    ok this may be easy for u great brains-
    i am developing a web site and would be taking space and bandwidth from freeservers.com. Now the problem is that I can cater only to the North American market, and this site would be useless to non Americans/ Canadians, so I wish to block my site from ip addresses not originating from North America, to save my bandwidth.
    Please Help !!!

    The problem is not getting the IP address, but figuring out where it originates. The only way I have seen this done is to do a trace route to that IP. (type tracert airchina.com.cn at a command prompt. I'm assuming they are hosted in China).
    The IP's between you and they are routers and switches. One or two of them are going to be the monster switches routing traffic in and out of a country. These are the ones you are going to be interested in. You will need to build (or buy) a database of these. If the trace route goes through an international switch, you can assume it's in a different country.
    Now, this would be simple if there were only one or two switches in or out of a country. I have no statistics, but I bet the US has thousands.
    Next, I seem to remember that trace route use thes ICMP protocol. There is no support for ICMP in Java.
    Finally, you might be able to find a company who provides this service (or a foriegn DNS blocking service). Read $$$$.

  • How to get the Ip address of machine from which a connection is obtained

    Hi,
    We are using Oracle HA solution and we would use at least 2 Db servers. I would like to know whether there is any way of obtaining the Ip address of the machine from which the connection has been obtained?
    Thanks
    Himadri

    know whether
    there is any way of obtaining the Ip address ofthe
    machine from which the connection has beenobtained?
    Let me get you right. Basically looks like you want
    to get the IP address of the client machines who
    connect to your server? Yes it very much possible.
    Even a simple tool like netstat -a -n display
    the IP addresses/port of remote hosts (clients). Its
    part of the IP protocol to carry the addresses in the
    packets. The question is how do you want to do this
    in java? You should look at
    java.net.ServerSocket.accept().getInetAddress()
    API
    trust it helps,
    -BJNo. I have multiple databases which are used in a Oracle RAC solution. You can obtain connections from more than one DB servers. My question was how to obtain get the IP address of the DB Server from which the connection has been obtained.
    Himadri

  • Getting the IP Address of an HttpURLConnection

    I'm using an HttpURLConnection to fetch a web page, and would like to get the IP address of the remote computer that I'm fetching from. I know that I could simply call
    InetAddress.getByName(hostName).getHostAddress()
    first to resolve the domain name, but that's not going to work for me. The remote host has some sort of round-robin DNS system and I don't want to know what IP address the name "could" resolve to, I want to know what's the IP being used in the case where I call HttpURLConnection.connect().
    It seems like the IP address is burried deep inside the abstracted layers. Any way to get at them?

    Actually, not a bad question. It's kind of involved, so I'll give you the gist.
    I'm automatically fetching some data from a URL that ultimately resolves into a big server farm. The software on the servers in the farm is being updated on an ungoing basis, and often different servers run different versions of the software as the updates roll out. One piece of information I fetch is the software's version number.
    I'm trying to model how these updates are rolling out, so I set up some automated process around the world to grab this data from the URL periodically and watch how and when the version numbers change. One piece of information that would be valuable to have is knowing when I hit the same physical server twice, hence I need the IP address. Yes, I know that the IP address probably really represents a load balancer, but it does get me one step closer to understanding how the whole process of updating these servers works.
    Hope this makes some sense.

  • 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

  • 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 :))

Maybe you are looking for

  • Error message "The operation can't be completed because an item with the name .DS_Store already exists"

    Major headaches with copying files and folders between drives. I constantly (and I mean constantly) have to resort to copying files across in small batches (fewer than 10 works best) because anytime I try to copy lots of files and folders from my mac

  • Street View in Maps-Can't find

    I recently got my iPhone 3G and i've heard that with software version 2.2 that you can see the street view on Google Maps application. I can't seem to find out how to access the street view. Am I just blind or is there a setting that needs to be swit

  • Error in simple java code.

    Hi folks,    I am having some problem to compile this code, anybody can help me please ? Thanks a lot. Patricio. package Duck02; import java.util.List; import com.sapportals.portal.prt.component.*; import com.sapportals.wcm.repository.IResource; impo

  • Publish completed, but no new folio in viewer

    I've published a new folio to our branded viewer, but it still hasnt shown up in the viewer. Usually, I can count on the folio showing up within minutes after the 'completed' message. I know there were server issues yesterday, so maybe there are stil

  • Problems doing the jump between queries

    Hi BI experts! I've a problem when I jump from header query to detailed level one. It's difficult to explain, but I try it! In header query I have Vendor, VAT Reg. No, Total Num of invoices and Total Net Amount. The Header report shows (always speaki