InetSocketAddress createUnresolved Example

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


InetSocketAddress class createUnresolved example. public static InetSocketAddress createUnresolved(String host, int port) Creates an unresolved socket address from a hostname and a port number. No attempt will be made to resolve the hostname into an InetAddress. The address will be flagged as unresolved.

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

import java.net.*;

public class CreateUnresolved {

    public static void main(String args[]) {

        //Creates an unresolved socket
        InetSocketAddress inetSocketAddress =
                InetSocketAddress.createUnresolved("192.168.10.222"1313);
        
        // Gets the InetAddress
        System.out.println(inetSocketAddress.getHostName());
    }
}

Output
192.168.10.222

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

HOME | COPYRIGHT | CONTACT US