Java Local Address Get getLocalAddress(int port)

Here you can find the source of getLocalAddress(int port)

Description

get Local Address

License

Apache License

Declaration

public static InetSocketAddress getLocalAddress(int port) throws UnknownHostException 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

public class Main {
    public static InetSocketAddress getLocalAddress(int port) throws UnknownHostException {
        String ipAddress = InetAddress.getLocalHost().getHostAddress();
        return new InetSocketAddress(ipAddress, port);
    }//from w  w  w.jav a2 s  .c o  m
}

Related

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