I'm currently facing a pretty odd network error. Firstly I'm using a Wemos D1 mini with the newest firmware installed. I'm trying to setup a simple network configuration mode over a access point, therefor I currently also I develop an app to communicate with the microcontroller.
The entire code for the microcontroller is written and works perfect when the controller is connected to my wifi. However when trying the same using an access point the controller seams to never receive any communication.
So to make sure that my understanding of networking is right. Beeing in the same network as the controller which is hosted by the controller (access point) and the socket is bound to the address that the socket gives me desolving the '0.0.0.0' address, I should be able to simply make request targeting the address of the controller (192.168.4.1) and then the socket should receive them, right?
That also what my code does and it basicly the same as other tutorials that I have found.
So here are some code bits. (I'm new here and don't know whether I can use code formation, sorry for that)
I set up my AP using this code:
Code: Select all
sta_if = network.WLAN(network.STA_IF)
sta_if.active(False)
ap_if = network.WLAN(network.AP_IF)
ap_if.active(True)
mac = ubinascii.hexlify(network.WLAN().config('mac'), ':').decode()
ap_if.config(essid="epsLightServer_{}".format(mac[:5]))
ap_if.config(authmode=network.AUTH_OPEN)
I set up my socket using this code:
Code: Select all
address_info = socket.getaddrinfo('0.0.0.0', 80)
print("Hostinfo: {}".format(address_info))
address = address_info[0][-1]
self._socket = socket.socket()
self._socket.bind(address)
self._socket.listen(1)
self._socket.setblocking(False)
self._socket.settimeout(5)
Code: Select all
try:
client, address = self._socket.accept()
print("New connection from: {}".format(address))
data = self.receive_all_data(client)
except OSError:
pass
I don't know where to go from here. I can't find anyone online with the same problem. I also have 2 boards which both produce the same error. The even run on different firmware versions, still the same problem.
Does anyone know what I'm doing wrong? Or is it a bug thats bound to the wemos d1 mini?
Thanks for help in advance!
Manuel S.