You are reading a single comment by @Mark and its replies. Click here to read the full conversation.
  • Hello!
    This code works. (V1.91)
    function onPageRequest(req, res) {
    res.writeHead(200, {'Content-Type':'text/html'});
    res.write('Hello');
    res.end('');
    }
    require("http").createServer(onPageReque­st).listen(80);
    var wifi = require("Wifi");
    console.log("APIp="+wifi.getAPIP().ip);
    console.log("StationIP="+wifi.getIP().ip­);

    After the command "Save();" code is not working.
    Why?


    1 Attachment

    • test01.jpg
  • 
    function onPageRequest(req, res) {
    res.writeHead(200, {'Content-Type':'text/html'});
    res.write('Hello');
    res.end('');
    }
    
    var wifi = require("Wifi");
    
    E.on('init',function () {
       require("http").createServer(onPageReque­st).listen(80);
       console.log("APIp="+wifi.getAPIP().ip);
       console.log("StationIP="+wifi.getIP().ip­);
    });
    
    

    Note that that won't work immediately after uploading, only after save(), since the initialization takes place in the init callback. It's often not practical to make code that works both after direct upload and after save() and restart.

About

Avatar for Mark @Mark started