why micropython ESP8266 nodemcu Wifi socket not working

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
yefj
Posts: 7
Joined: Thu Dec 17, 2020 9:20 pm

why micropython ESP8266 nodemcu Wifi socket not working

Post by yefj » Thu Dec 17, 2020 9:59 pm

I want to see a web page from my created wifi network, i have managed to asemmble the following code shown bellow,with socket as shown bellow i enter the wifi network,then i write the IP adrress( i tried them both) and nothing.

i have done exactly as in the manual shown bellow, i cant get any webpage Where did i go wrong?
https://www.youtube.com/watch?v=GVMuER7A770

Code: Select all

import network
import usocket as socket
ap_if = network.WLAN(network.AP_IF)
ssid = 'MicroPython-AP29'
password = '123456789'
ap_if.active(True)
ap_if.config(essid=ssid, password=password)

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('',80))
s.listen(5)
while True:
    conn, addre=s.accept()
    request=conn.recv(1024)
    request=str(request)
    response="gyhkjgku"
    conn.send("HTTP/1.1 200 OK\n")
    conn.send("Content-type: text/html\n")
    conn.send("Connection: close\n\n")
    conn.sendall(response)
    conn.close()

Post Reply