Web Development

Tuesday, November 25, 2014

Find the address of the local machine

import java.net.*;

class myAddress {

  public static void main (String args[]) {

    try {
      InetAddress address = InetAddress.getLocalHost();
      System.out.println(address);
    }
    catch (UnknownHostException e) {
      System.out.println("Could not find this computer's address.");
    }

  }

}
Posted by Hasini at 5:40 PM
Labels: Java_NetworkProgramming

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2018 (2)
    • ►  July (1)
    • ►  June (1)
  • ►  2016 (7)
    • ►  September (3)
    • ►  August (3)
    • ►  July (1)
  • ►  2015 (12)
    • ►  September (1)
    • ►  August (5)
    • ►  July (2)
    • ►  March (3)
    • ►  January (1)
  • ▼  2014 (15)
    • ▼  November (6)
      • Find the IP address of the local machine
      • Find the hostname of the local machine
      • Find the address of the local machine
      • : A program that prints all the addresses of www.a...
      • A program that prints the address of 72.167.232.155
      • A program that prints the address of www.oreilly.com
    • ►  April (1)
    • ►  March (3)
    • ►  February (5)
  • ►  2008 (1)
    • ►  June (1)

About Me

Hasini
View my complete profile
Travel theme. Theme images by neomistyle. Powered by Blogger.