Created
September 22, 2017 14:03
-
-
Save CelliesProjects/d8f249312f3ef50c21d215c87590eb1c to your computer and use it in GitHub Desktop.
Pseudo code to show how to allocate an instance of a server on ESP8266 or ESP32.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
ESP8266WebServer *server; | |
void setup(){ | |
//This allocates a new instance of ESP8266WebServer | |
server=new(ESP8266WebServer); | |
if(server==NULL) //Insert code to handle allocation-error | |
//Setup your server here | |
server->begin(); | |
} | |
servernolongerneeded(){ | |
//This destroys the allocated server and frees up all the resources it used | |
delete(server); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment