Connection attempt failed with "EAI_NONAME - Neither nodename nor servname provided, or not known". 1

Connection attempt failed with “EAI_NONAME – Neither nodename nor servname provided, or not known”.

You can use the following methods

In my personal experience, these methods below really helps me dealing with ftp

1. default port is 21, make sure to check if your host port is also 21.
2. remove ftp:// in the hostname.
3. use hostname IP address, you can try both with and without ftp://.
4. maybe the hostname is blocked in your country, try to use proxy or a VPN.
5. Using Plain FTP(unsecure) may be a solution but it is NOT RECOMMENDED because it pose threats to your server.

Here is what the above code is Doing:
1. It is creating a FTP object and connecting to the FTP server.
2. It is changing the directory to the one you want to download the file from.
3. It is downloading the file.
4. It is closing the connection.

Similar Posts