InetSocketAddress getAddress Example

InetSocketAddress class getAddress example. This example shows you how to use getAddress method.


InetSocketAddress class getAddress example. This example shows you how to use getAddress method.

Here is the code
/*
 * @ # GetAddress.java
 * A class repersenting use to GetAddress method 
 * of InetSocketAddress class in java.net package
 * version 23 June 2008
 * author Rose India 
 */

import java.net.*;

public class GetAddress {

    public static void main(String[] argsthrows Exception {

        //Get local host.
        InetAddress inetAddress = InetAddress.getLocalHost();

        InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, 1313);

        //Gets InetAddress.
        System.out.println("Inet Address " + inetSocketAddress.getAddress());
    }
}

Output
Inet Address komal-desktop/127.0.1.1

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US