ServerSocket GetInetAddress() Example

Returns the local address of this server socket


ServerSocketclass GetInetAddress() method example. This example shows you how to use GetInetAddress() method.This method Returns the local address of this server socket

Here is the code:-

/**
 * @Program that Returns the local address of this server socket.
 * GetInetAddress.java 
 * Author:-RoseIndia Team
 * Date:-21-jun-2008
 */
import java.net.*;

public class GetInetAddress {

    public static void main(String[] argsthrows Exception {
        InetAddress i = InetAddress.getByName("girish-desktop");
        ServerSocket ss = new ServerSocket(80800, i);
        //Returns the local address of this server socket
        System.out.println(ss.getInetAddress());
    }
}

Output of the program:-
 girish-desktop/127.0.1.1

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

HOME | COPYRIGHT | CONTACT US