-->
Page 2 of 5

Re: How do you REALLY change the host name?

PostPosted: Thu Aug 04, 2016 3:35 pm
by martinayotte
BTW, to convert String to char * easily, there are methods provided :
Code: Select allString routername = "Testing123";
wifi_station_set_hostname(routername.c_str());

I'm using the same method in my sketches, and it is working on my side.
So, maybe the problem is on the router side, maybe it have cache an kept the old name used before.
Try to power recycle the router to see if it help.

Re: How do you REALLY change the host name?

PostPosted: Fri Aug 05, 2016 12:32 am
by rudy
martinayotte wrote:BTW, to convert String to char * easily, there are methods provided :
Code: Select allString routername = "Testing123";
wifi_station_set_hostname(routername.c_str());


I tried that but I got this error

error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

Re: How do you REALLY change the host name?

PostPosted: Fri Aug 05, 2016 12:03 pm
by martinayotte
Yes, you are right !
But it need a simple cast to fix the error :
Code: Select allString routername = "Testing123";
wifi_station_set_hostname((char *)routername.c_str());

Re: How do you REALLY change the host name?

PostPosted: Fri Aug 05, 2016 8:35 pm
by JimDrew
This compiles, but still does not change the name seen by the router. I powered off/on the router and that made no difference. I am using AP mode, not station mode. Is this this the difference?