I am trying to use inet_gethostbyname()
on my electron, in the same way that TCPClient::connect()
does and I am running into compile errors.
Code:
const char *host = "www.google.com";
IPAddress ip_addr;
int ret = inet_gethostbyname(host, strlen(host), ip_addr, 0, NULL);
Serial.printf("inet_gethostbyname %i\n", ret);
Compile Error:
In file included from ../wiring/inc/spark_wiring.h:41:0,
from ./inc/application.h:36,
from applications/gethost/application.cpp:21:
../wiring/inc/spark_wiring_ipaddress.h: In function 'void setup()':
../wiring/inc/spark_wiring_ipaddress.h:46:5: error: 'IPAddress::operator HAL_IPAddress*()' is private
operator HAL_IPAddress* () {
^
applications/gethost/application.cpp:43:67: error: within this context
int ret = inet_gethostbyname(host, strlen(host), ip_addr, 0, NULL);
If I make operator HAL_IPAddress* ()
public it seems to work without any issue. I am wondering if there is another way to do this or if this can safely be made public?