As the title says... Chat on...

User avatar
By JumpZero
#63085 Hello,

I just have 2 questions related to the net module, I have not found the answers in the doc, there are several discussions about this subject on various web sites, but I'm afraid most of these discussions are outdated. I'm running latest firmware master branch 2.0.
So here are the questions:
-1 : Is it possible to run simultaneously a tcp server (http server) and a tcp client (http as well)?
-2 : Is it possible to run 2 tcp servers?
For the 1 I do it and it's ok, I run a http server and every 5 minutes I open a tcp connection to send data to a remote web site (ThingSpeak). It runs fine since 2 days. I just want to confirm it's ok to do this, and I won't get problems later.
For the 2 I do it also (on another ESP8266) and it's also ok, I have an http server and a telnet server (the one given in this examples http://www.nodemcu.com/index_en.html#fr ... 501100000f ). I'm just surprised than the net module can handle 2 tcp servers, because I have often read it's limited to one.

Thanks
--
Jmp0
User avatar
By marcelstoer
#63105
JumpZero wrote:Is it possible to run simultaneously a tcp server (http server) and a tcp client (http as well)?


Sure. The HTTP client can also be from the http module (instead of net module).

JumpZero wrote:Is it possible to run 2 tcp servers?


I never tried and docs don't say as you noted. However, it may very well be that NodeMCU versions prior to v2.0 didn't support that. With v2.0 the net module foundation was re-written on top of lwIP, see https://github.com/nodemcu/nodemcu-firm ... r_20170202.