1

I am trying to run a mini web server on my ESP32 feather huzzah32, but I hit an error every time I try to open the console. I tried several times, updated everything, erased the flash also few time to start over and the same.

The line 37 seems to have a problem I cannot figure out.
When I am done with compiling and upload the code, I see this error:

(IOError @[0047:0013:0000:0048:0000:0000:0000:0000]
oops, something wrong while linkin:
(IOError at line 37 of main raised at line 97 of wireless.wifi.link

Here is my code.

import streams
import socket


from wireless import wifi


from espressif.esp32net import esp32wifi as wifi_driver

streams.serial()

wifi_driver.auto_init()

    wifi.link("my-ssid",wifi.WIFI_WPA2,"my-password")
except Exception as e:
    print("ooops, something wrong while linking :(", e)
    while True:
        sleep(1000)


print("Linked!")

info = wifi.link_info()
print("My IP is:",info[0])

sock = socket.socket()
sock.bind(80)
sock.listen()


while True:
    try:


        client = streams.SocketStream(clientsock)


        line = client.readline()
        while line!="\n" and line!="\r\n":
            line = client.readline()
        print("HTTP request received!")


        print("HTTP/1.1 200 OK\r",stream=client)
        print("Content-Type: text/html\r",stream=client)
        print("Connection: close\r\n\r",stream=client)

        print("<html><body>Hello Zerynth!",random(0,100),"</body></html>",stream=client)

        client.close()
    except Exception as e:
        print("ooops, something wrong:",e)

I am using Zerynth.
Any ideas?

1 Answer 1

1

I found the issue. It was a bit silly but often errors are indeed silly. Istead of using routers SSID, I tried with the name of the WIFI network and it worked just fine. There is the code, line 37.

wifi.link("NAME_OF_THE_NETWORK",wifi.WIFI_WPA2,"NETWORK_PASSWORD")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.