Left for archival purposes.

User avatar
By Larry
#18216 If a server is created with
Code: Select allserver = net.createServer(net.TCP, 30)
server:listen(80)

then the reference to the server is lost, for instance, because a file is reloaded, then there is no way to close that server or get access to it. If the server is not closed then it is not possible to create a new server without resetting the board.

Is it possible to add either net.getServer() that returns the server created by net.createServer(), or net.closeServer() that releases that server.
User avatar
By TerryE
#18470 Why not just make server a global? Then you can do something like:
Code: Select allif server then server:close () end
User avatar
By Larry
#21843 If some other code calls server net.createServer(net.TCP, 30) and does not make it public then the only solution at present is to reboot. This is already a static object buried somewhere in the code. Exposing that object makes the API more complete.
User avatar
By TerryE
#21857 Agreed, but most ESP8266 Lua apps are single developer, and the fact that the SDK only supports one TCP server at a time is a design constraint. Surely this isn't a big issue in the overall scheme of things.