esp8266-be the server and links many clients at the same time

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Henry6107
Posts: 1
Joined: Sun Apr 28, 2019 4:53 pm

esp8266-be the server and links many clients at the same time

Post by Henry6107 » Sun Apr 28, 2019 5:05 pm

Just like the topic, is it possible to use esp8266(NodeMCU) as a server,

and then links more than one client at the same?

I search on the net and found out that '' micro python does not support multi-threads ''.

and I found out a function called ' socketServer()', which supports server to link many clients at the same time,
but everyone uses this on the computer rather than the esp8266.

I need help QAQ thx!

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: esp8266-be the server and links many clients at the same time

Post by Roberthh » Sun Apr 28, 2019 6:22 pm

You can use MicroPython devices as a server. However, due to its restrained resources the esp8266 may not be the best choice. The ESP32, especially the model with SPIRAM, is better suited and also supports threading, just like the PyBoards. The new PyBoard model comes with integrated WiFi/Bluetooth.
It is possible to implement some kind of service to multiple clients on an esp8266 using a callback mechanism, but only for very simple services, which respond fast and do not use much memory.
The socketserver module is not implemented in MicroPython, and I do not know if anyone has ported/implemented that yet.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: esp8266-be the server and links many clients at the same time

Post by pythoncoder » Mon Apr 29, 2019 6:25 am

It is possible to write a server using uasyncio rather than threading to handle concurrency. This is much more efficient on resource constrained devices.
Peter Hinch
Index to my micropython libraries.

Post Reply