Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bind server on 0.0.0.0:80. #76

Open
JohannesMaierhofer opened this issue Feb 14, 2022 · 3 comments
Open

Cannot bind server on 0.0.0.0:80. #76

JohannesMaierhofer opened this issue Feb 14, 2022 · 3 comments

Comments

@JohannesMaierhofer
Copy link

Hi, I'm trying to run MicroWebSrv2 on the Arduino RP2040 nano Connect via a wifi connection.
But I ended up in MicroWebSrv2Exception: Cannot bind server on 0.0.0.0:80.

Here is my minimal example:

import network

SSID ='My_Nano_RP2040_Connect'   # Network SSID
KEY  ='1234567890'  # Network key (must be 10 chars)

# Init wlan module and connect to network
wlan = network.WLAN(network.AP_IF)
wlan.active(True)
wlan.config(essid=SSID, key=KEY, security=wlan.WEP, channel=2)
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))

from MicroWebSrv2 import *
from time         import sleep

mws2 = MicroWebSrv2()
mws2.SetEmbeddedConfig()
mws2.StartManaged()

# Main program loop until keyboard interrupt,
try :
    while True :
        sleep(1)
except KeyboardInterrupt :
    mws2.Stop()

@JohannesMaierhofer
Copy link
Author

Additional information: The following line causes the issue, as it seems not available for the RP2 port of usocket.
srvSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

@concentrateddon
Copy link

I'm successfully running MWS2 on a Pico W, but I did have to manually use Bind() to specify my IP address and port, once I connected the W to the WLAN and had an IP. Letting it default-bind to 0.0.0.0 wasn't working.

@fschlaef
Copy link

I'm successfully running MWS2 on a Pico W, but I did have to manually use Bind() to specify my IP address and port, once I connected the W to the WLAN and had an IP. Letting it default-bind to 0.0.0.0 wasn't working.

How did you manage to make it work ? Even manually binding the RPI Pico IP address and port, I am still getting the same error Cannot bind server on 192.168.1.113:8000, same with port 80 and IP 0.0.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants