-->
Page 1 of 2

Obtaining ip adress of a remote server

PostPosted: Mon May 30, 2016 9:34 pm
by Solexious
Hey all,

I might just be using the wrong terms to search for this, but I cant find how to:

I want to get the ip address of an address, i.e. control.myserver.com to use elsewhere in my script, how can I look that up (within the esp)?

Cheers

Sol

Re: Obtaining ip adress of a remote server

PostPosted: Tue May 31, 2016 1:16 am
by Pablo2048
Just try
Code: Select all#include <Dns.h>
IPAddress ipa;

... dns_gethostbyname("server.com", &ipa);

(see dns.h for information...)
EDIT: Look into ESP8266WiFiGeneric.cpp and search for hostbyname...

Re: Obtaining ip adress of a remote server

PostPosted: Tue May 31, 2016 10:20 am
by Solexious
Thanks!

Will give it a look :)

Re: Obtaining ip adress of a remote server

PostPosted: Tue May 31, 2016 6:42 pm
by Solexious
Having a few issues using the class, I'm currently including:
Code: Select all#include <ESP8266WiFi.h>

That should include ESP8266WiFiGeneric.cpp

But when I try:
Code: Select all    IPAddress ipa;
    WiFi.hostbyname(serverName, &ipa);


I get:
Code: Select all'class ESP8266WiFiClass' has no member named 'hostbyname'


I'm currently running version 2.3.0-rc1 of the library installed via the board manager.

Any ideas why I can't seem to call it?