• When you wrote this

    http.createServer(pageHandler).listen(80­80);
    

    You're setting up the server to listen on port 8080 i.e http://ip address :8080. It is distinct from port 80. 80 is the default for http - so the only one you don't have to explicitly call in the URI if your server is listening on port 80. Similarly 443 is the default for a server offering SSL/TLS via HTTPS

    You need to contact the server using the port it is listening on - if that is port 80 you can omit it.

    Beyond that you need to have a response handler - your pageHandler function that can output the correct response that a browser can use/understand. The Espruino page on Internet has numerous examples that will help you write the handler function.

    Edit:
    Re Telnet. Once you have Wifi setup and you are connected. If you know the IP address of your board, and set that up on the communications page as x.x.x.x:23, you should be able to establish a Telnet connection - unless the build of Espruino you are using has had Telnet option turned off. Standard builds should have Telnet enabled.

  • Sat 2017.02.25

    Quoting King Arthur had to consult "The Book of Armaments!"

    I have previously used port 8080 as an alternative to no port specified when using http. Bewildered when omitting that and the browser wouldn't connect.

    Confirmed that :8080 is an official alternative for :80

    This is a list of Internet socket port numbers used by protocols of the transport layer of the Internet Protocol Suite for the establishment of host-to-host connectivity

    8080 TCP UDP Alternative port for HTTP. See also ports 80 and 8008. Official

    and also at: https://www.reference.com/technology/por­t-8080-used-ca5f438b749de7de

    Port 8080 is an alternative to port 80 and is used primarily for http traffic. It is named 8080 for its correlation to 80

    What I found during testing is that the wifi.connect() function takes the .listen(8080) port reference literally, requiring the absolute use of 192.168.1.71:8080 in the address field of the browser. It is not recognized as an alternative to http browser requests, if not included.
    e.g. Espruino 1v89 at this testing doesn't follow the spec verbatim, port :8080 can not be assumed an alternative and be resolvable when making a request without a port designation, such as 192.168.1.71

    This subtle difference forces the use of .listen(80) when it is desired that no port is specified.

About

Avatar for Robin @Robin started