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

Confused on how to get working #5

Open
GanerCodes opened this issue Jun 25, 2021 · 3 comments
Open

Confused on how to get working #5

GanerCodes opened this issue Jun 25, 2021 · 3 comments

Comments

@GanerCodes
Copy link

GanerCodes commented Jun 25, 2021

Here is my simple setup:


import network
from microDNSSrv import MicroDNSSrv

ap = network.WLAN(network.AP_IF)
ap.ifconfig(("192.168.4.1", "255.255.255.0", "192.168.0.1", "10.0.0.1"))
ap.active(True)
ap.config(essid = "Simple Test", password = "")

while ap.active() == False: pass

print('Created AP.')
print(ap.ifconfig())

if MicroDNSSrv.Create({"*": ap.ifconfig()[1]}):
    print("yay")
else:
    print("Error to starts MicroDNSSrv...")

print()
print("=======================================================================")
print()

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 80))
s.listen(5)

with open('index.html', 'r') as f:
    pageHTML = f.read()

while True:
    conn, addr = s.accept()
    print('Got a connection from %s' % str(addr))
    request = conn.recv(1024)
    print(request)
    conn.send(pageHTML)
    conn.close()

however, if I connect to the AP on my phone there is no prompt, and going to some arbitrary website does not redirect me. What am I doing wrong?

@max-win-at
Copy link

I have a very similar setup and the same issue. It's been some years, did you came up with a solution you can share?

@GanerCodes
Copy link
Author

I have a very similar setup and the same issue. It's been some years, did you came up with a solution you can share?

Nah unfortunately not; I just have the user navigate to 192.168.4.1 in their browser; pretty annoying ngl

@max-win-at
Copy link

I got it working by refactoring to this solution https://github.com/pimoroni/phew Pretty neat.

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

2 participants