String str = "192.168.1.100"; String[] ipStr = str.split("\\."); ]; ; i < ; i++){ ipBuf[i] = (byte)(Integer.parseInt(ipStr[i])&0xff); } try{ InetAddress ia = InetAddress.getByAddress("Server",ipBuf);