How to get hostname of a remote computer by ip

how to get hostname of a remote computer by ip

In InetAddress class we have a method
public String getHostName() which returns the name of the host. If applet security prevents the name, the same ipaddress entered is returned back.
This program is the implementation of this method:
import java.net.*;
public class ipdemo
public static void main(String arg[])
try
InetAddress add=InetAddress.getByName("207.228.236.39");
System.out.println(add.getHostName());
catch(UnknownHostException e)
System.out.println("Exception raised");
This will help you.
Regards.
Deepa Datar

Similar Messages

  • How to get Mac Address of Remote Computer

    Hi All,
    I tried to find out a solution for finding Mac Address of a remote system, then first i tried with finding it with local address using the following code it works fine for me.
    public class MacAddressFinder {
         public static void main(String[] args) {
              try
                   InetAddress ipAddr = InetAddress.getLocalHost();
                   System.out.println("Current IP address : " + ipAddr.getHostAddress());
                   NetworkInterface nwIntf;
                   try
                        nwIntf = NetworkInterface.getByInetAddress(ipAddr);
                        byte[] hwAddr = nwIntf.getHardwareAddress();
                        System.out.print("Current MAC address : ");
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i < hwAddr.length; i++)
                             sb.append(String.format("%02X%s", hwAddr, (i < hwAddr.length - 1) ? "-" : ""));          
                        System.out.println(sb);
                   } catch (SocketException e) {
                        e.printStackTrace();
              catch (UnknownHostException e) {
                   e.printStackTrace();
    But when i tried this piece of code in jsp with the following code i am getting NeworkInterface object value as null and there by i am unable to get the Mac Address of a remote computer.
    InetAddress ipAddr = InetAddress.getByName(request.getRemoteAddr());
    NetworkInterface nwIntf = NetworkInterface.getByInetAddress(ipAddr);Can you please suggest me how to find out the Mac address of remote system?
    Thanks,
    Uday

    first of all, NetworkInterface only exposes the NetworkInterfaces of the local computer. secondly, you cannot find the mac address of an arbitrary remote computer. that information is not available outside of the local subnet. and java doesn't expose a way to discover it even for computers on the local subnet.

  • My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help

    My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help
    !!!!!

    Hey kevyg3,
    I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    Hope this helps,
    David

  • How To: Get encoding of a remote file

    How To: Get encoding of a remote file
    Java EE
    URL url = new URL ("http://www.someSite.com/myCsvFile.csv"); // comma separated
    InputStream is = url.openConnection().getInputStream();
    InputStreamReader reader = new InputStreamReader(is);
    System.out.println("reader.getEncoding(): " + reader.getEncoding());
    For both an ISO-8859-1 file and a UTF-8 file I get the following print out:
    reader.getEncoding(): Cp1252
    Could it have something to do with this warning during boot the .war?
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    If I use local files it prints ISO8859_1 for one of the files.

    All of that is because the HTTP server attaches a charset to every response. That's what you are seeing. The server may be using some logic to determine the actual encoding of the file it returns, or it may simply be using a hard-coded charset which may or may not be suitable for reading the file. The latter is unfortunately more likely.
    By the way if you receive an XML file over HTTP, and the HTTP charset differs from the encoding declared in the XML document, there's a rule which says the HTTP charset takes precedence. (I don't know where that rule is documented, but I have encountered that situation in real life -- the data came from a Google application -- and that rule was indeed the right thing to do.)
    If you're still under the impression that there's something which can look at a file and determine what encoding was used to produce it, let me tell you that there isn't. Sure, there's that XML prolog thing which works for XML files (if they weren't botched by the producer), but for text files in general there's no way to determine their encoding. Short of asking the person who created them, that is.

  • So my computer crashed and i had lost all my itunes purchases and dont know how to get them back, so my computer crashed and i had lost all my itunes purchases and dont know how to get them back

    so my computer crashed and i had lost all my itunes purchases and dont know how to get them back, so my computer crashed and i had lost all my itunes purchases and dont know how to get them back

    You have a backup of your computer, or at the very least of your iTunes media, correct?
    Simply copy your backup of your iTunes media into the iTunes library on your new computer.
    Connecting and syncing your device to the new computer without first recovering your iTunes media is a really, really, really bad idea.  iDevices are designed to ONLY sync with one computer.  When you plug your device into a new computer, it will wipe all media on the device when it syncs.  The only media you may be able to salvage and transfer to the new computer would be anything bought directly on the device.
    If you do not have a backup of your iTunes media, then you will want to either look at a way (using software from a third party company)  to either extract the media from you iDevice or your old computer (assuming the hard drive is not toast).

  • How to get hostname from targetlist in custom deployment procedure?

    When I make a simple procedure with a phase that will loop through a procedure hostname list
    and a hostcmd or directive inside that will use the hostname ex change a configuration file. How to get hostname from the hostname targetlist?
    I would rather not use $(hostname) or similar function if I can get the hostname from the target list.
    Edited by: user476601 on 2012-09-06 05:59

    I have tried that and cannot get it to work.
    I have tried to make a procedure with:
    parameter
    - parallel fase
    - step directive with hostname parm based on simple sh script (echo $hostname)
    - map hostname setvalue %TargetName%
    In a hostcmd step you cannot access %TargetName% directly
    it doesn't work. Please come with an example if you have tried it.
    /René

  • Get ip address of remote computer

    How can i get the ip address of remote computer?I just find the InetAddress.getLocalhost() method to get local ip.
    How should I do ?

    You can use the jCIFS NTLM filter to authenticate the user against a
    domain and get their NT username via request.getRemoteUser(); this is available from:
    http://jcifs.samba.org
    The filter is transparent to your web application, so you shouldn't need to make any additional code changes.
    Eric

  • My computer broke down and i needed to install everything new. t now all my music is only on my ipod classic. does anyone have an idea how to get it back to my computer without deleting it from the ipod?

    my computer broke down and i needed to install everything new. now all my music is only on my ipod classic. does anyone have an idea how to get the music back on the computer without deleting it on the ipod?

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • HT1390 i rented a movie on my ipad but I am unable to download it on my ipad not enough space.  So now I would like to watch the movie on my laptop .. but i don't know how to get the movie on my computer.. help?

    I rented a movie last night on my ipad but I am unable to download it on my ipad I have no space.. so I want to watch it on my laptop computer but do not know how to get the rented movie on it.  I checked the itune store and they said I have it rented.. So I need help on what to do to download it on my computer so I can watch it any suggestions?  Thanks.

    Niel wrote:
    Because rented movies from the iTunes Store are normally a one-time download per rental, and if that download was to an iOS device, they can't be transferred to any other device.
    Does that hold in the other sense as well? A rental on the computer is non-transferrable to the iGadget?

  • How to get my photostream pictures onto computer in windows

    I have an Iphone 5s, and am going on a trip and need to get all my photos off my phone so I have more room. I have a windows computer, and am trying to get my photostream photos from my phone onto my computer and got some yesterday but not all because I had to leave. Now I cannot get hte rest on. I was doing it via Icloud because that is all I can do for photostream. PLEASE HELP ME GET THE REST ONTO MY computer! I also do not know how to delete all the photos off my photostream! HOW DO I DO THAT??

    Open the my photo stream album in the thumbnail view, tap Edit, tap the photos to select them, tap Share, tap Save to Camera Roll.

  • How to get the clientname (name of computer) ?

    Hi all,
    we use Forms 10.1.2.0.2 together with OAS.
    We have a form that calls a JavaBean.
    We´d like to get the clientname by using the bean.
    With InetAddress.getLocalHost().getHostName() we get the name of the client when running in Forms Developer (ok). When running on OAS we get "localhost" (not what we need). So this isn`t the function to solve our problem. Does anyone know how to get the clientname ?
    Regards
    Frank

    Hi and thank you for your reply :)
    Originally we started using the webutil function and it gave back the result we needed. But for some reasons we had to switch to the JavaBean technology and that´s why we are looking for a function to get the clientname even when we´re on OAS.
    Regards
    Frank

  • How i get my ip camera remotly

    how i get my ip camera remotly

    Try to be more specific. Do you have an IP camera attached to your LAN (WiFi router)? Do you want to connect to it from anywhere in the world? If so, you may need to set up your router for "Port Forwarding" of the port your IP camera is running on.

  • How to get camera roll pictures to computer?

    So I wanna get my camera roll pictures to my computer before I completely redo my ipod cause Im scared theyll be deleted. I know on computers with out windows 8 you can go to "my computer" and find you ipod name & get to your pictures. On the computer I want to use I have windows 8 (with all the colored tiles)
    Is there a way to still do that?  i plugged in my ipod to my computer & tried to do it but couldnt find my ipod name.
    if anyone knows what to do get them off & to my computer with out itunes & what i have to do isnt that complicated, please let me know.

    Try using the photo-management software built in to your computer's operating system:
    Mac OS X: Open Image Capture (located in the Applications folder).
    Windows XP: Open the Microsoft Scanner and Camera Wizard by choosing Start > All Programs > Accessories.
    Windows Vista: Open Windows Photo Gallery by choosing Start > All Programs.
    Windows 7: Choose Start > Computer. Right-click on the logo of the device under Portable Devices (if present) and choose Import Photos.
    Additional Information
    Windows 7 Ultimate N edition or KN edition may not recognize iOS devices as cameras if the Media Feature Pack is not installed. This is available from Microsoft as a download for Windows 7 N with Service Pack 1 and Windows 7 KN with Service Pack 1: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=31017ed3-166a-4c75-b 90c-a6cef9b414c4.
    above from:
    iOS: Unable to import photos to computer
    Have you installed any camera or scanner programs on your computer?

  • How to get my textmessages to my computer?

    I have about 10 000 textmessages in my iphone. I'd like to get them to my apple computer, so i could read them easily, and maybe print them out ect.
    I'd really appreciate any usefull answers, so thanks everyone in advance!

    I have about 10 000 textmessages
    Just use the phone...
    http://www.markspace.com/iphone/

  • How to get music back on a computer from an Ipod

    Hello,
    I had to wipe my computer, and my files didn't backup properly so now I have no music. How do I get my music back onto my iTunes from my iPod, if I wasn't using the iCloud?
    Thank you,

    See Recover your iTunes library from your iPod or iOS device.
    tt2

Maybe you are looking for