Here you can find the source of createInetSocketAddress(String ip, int port)
public static InetSocketAddress createInetSocketAddress(String ip, int port)
//package com.java2s; //License from project: Open Source License import java.net.InetSocketAddress; public class Main { public static InetSocketAddress createInetSocketAddress(String ip, int port) { InetSocketAddress address = null; if (ip == null) { address = new InetSocketAddress(port); } else {// w w w.j ava 2 s .c o m address = new InetSocketAddress(ip, port); } return address; } }