-->
Page 1 of 1

WiFiServer vs. ESP8266WebServer

PostPosted: Mon Mar 14, 2016 12:36 am
by zmink
Hi all,

I've been working on integrating the HTTPUpdateServer into my esp arduino based project, and I've hit a snag. I get the following error during compilation:

no matching function for call to 'ESP8266HTTPUpdateServer::setup(WiFiServer*)'

The difference between my code and the example sketch is that I am using "WiFiServer" library to create a web server and handle http requests and it looks like the ESP8266WebServer library, which is used in the example, is different.

My question is, does anyone have a recommendation on the best path forward on this? Should I try to convert my code from using WiFi to use WebServer or should I do something else. I wasn't able to look into the libraries themselves yet, but could anyone comment on the actual differences?

Thanks for any thoughts!

Re: WiFiServer vs. ESP8266WebServer

PostPosted: Tue Mar 15, 2016 12:30 am
by zmink
To answer my own issue - it turns out that both the WebServer and WiFiServer libraries will work if run on different ports! For my application, running the webserver on an ephemeral port made a lot of sense. Therefore, I just set the upload server to run on a high port number and kept the original HTTP related code to run on port 80. This was great for me because I could keep two separate objects running and have separate chunks of code need to be rewritten or libraries extended. MDNS will still work for both port numbers as well, I believe as long as mdns.addService is used to add the port number.. Hope this helps someone else!

Re: WiFiServer vs. ESP8266WebServer

PostPosted: Tue Mar 15, 2016 12:20 pm
by nikant
zmink wrote:To answer my own issue - it turns out that both the WebServer and WiFiServer libraries will work if run on different ports! For my application, running the webserver on an ephemeral port made a lot of sense. Therefore, I just set the upload server to run on a high port number and kept the original HTTP related code to run on port 80. This was great for me because I could keep two separate objects running and have separate chunks of code need to be rewritten or libraries extended. MDNS will still work for both port numbers as well, I believe as long as mdns.addService is used to add the port number.. Hope this helps someone else!


wow.. thanks for this info! I was wondering about something like this in order to work around some issues on a project I have in mind

Re: WiFiServer vs. ESP8266WebServer

PostPosted: Tue Mar 15, 2016 1:49 pm
by martinayotte
Of course, you can use multiple servers on different ports.
For example, HTTP on port 80 along with Telnet on 23.