Java Local Address Get getLocalAddress()

Here you can find the source of getLocalAddress()

Description

get Local Address

License

Open Source License

Declaration

public static String getLocalAddress() 

Method Source Code


//package com.java2s;
import java.net.*;

public class Main {
    public static String getLocalAddress() {
        String addr = null;//from w  w w  .  ja v a  2s  . c  o m

        try {
            InetAddress ia = InetAddress.getLocalHost();

            if (ia != null)
                addr = ia.getHostAddress();
        } catch (UnknownHostException uhe) {
        }

        return addr;
    }
}

Related

  1. getLocalAddress()
  2. getLocalAddress()
  3. getLocalAddress()
  4. getLocalAddress()
  5. getLocalAddress()
  6. getLocalAddress(final String start, final String end)
  7. getLocalAddress(int port)
  8. getLocalAddress(int port)
  9. getLocalAddress(int port)