"Unable to resolve host no Address associated with hostname" While trying to connect ftp host through FtpClient()

31 Views Asked by At
        val file = File(localFilePath)
        val ftpClient = FTPClient()
        ftpClient.connectTimeout = 100*1000
       // ftpClient.connect(InetAddress.getByName(serverAddress))
        ftpClient.connect(serverAddress)
        ftpClient.login(userName, password)
        ftpClient.enterLocalPassiveMode()
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE)
        ftpClient.changeWorkingDirectory(folderPath)
        val inputStream = FileInputStream(file)
        success = ftpClient.storeFile(remoteFileName, inputStream)
        inputStream.close()

This is my code to connect and upload image into the folder in server. result - unable to resolve host while trying in android but able to connect and push images into server through webclient.

0

There are 0 best solutions below