Dnsclient Library

I have an application where I need to send a file to an FTP server. I only have the FTP server name (and not its IP address).

I tried using the dnsclient library however when compiling, I am getting the following errors:

lib/dnsclient/dnsclient.cpp:206:86: 'htons' was not declared in this scope
lib/dnsclient/dnsclient.cpp:299:59: 'htons' was not declared in this scope
lib/dnsclient/dnsclient.cpp:419:32: 'class IPAddress' has no member named 'raw_address'

I would appreciate any help in getting this resolved.

You could try the stock function WiFi.resolve()

What FTP library are you using?

I remember one that allowed you to use either the FTP server name or IP address.

1 Like

Thank you @ScruffR. Will try it.

Thank you @RWB. I am using the ParticleFTPClient library and it looks like it does accept a hostname. I will also try it.

1 Like

Thank you @ScruffR. I tried WiFi.resolve() and it worked for the Photon.

What is the equivalent function for the Electron (which is my target board)?

How does one find out in code if board is a Photon or an Electron?

Thanks in advance.

Thanks, I got it.

  1. Celluar.resolve()

  2. Using compiler directives (Electron PlatformID = 10)