1

I'm using 3 ESP8266 for my project: one ESP8266 is a server and controls any action.

I want to be able to connect to any ESP8266 with a phone and if that ESP8266 is a client, send data to the server.

I'm using TCP/IP for communication between ESP8266 models and ESP8266 with PC or phone.

My problem is with the number of clients. In ESP8266, a maximum of 5 TCP clients can connect to a server, and my master ESP8266 is using 2 (to connect to the other ESP8266), so that just leaves 3 clients (PC or phone) that can connect to the master ESP8266.

Is there any way to increase the number of clients?

Is there any alternative for communicating between ESP8266 models other than TCP/IP and leave 5 clients in ESP8266 for the user to connect?

7
  • Can I just clarify. You have set one ESP8266 as an access point and you want to be able to connect more than 5 clients to it? Nov 20, 2017 at 14:04
  • master model is AP
    – Ronix3
    Nov 20, 2017 at 14:35
  • others AP and station
    – Ronix3
    Nov 20, 2017 at 15:31
  • just buy a cheap router and connect them all to that.
    – dandavis
    Nov 20, 2017 at 19:57
  • 1
    @dandavis. Adding a router doesn't solve the OP problem. There are still 5+ clients trying to connect to his ESP8266 services.
    – user31481
    Nov 20, 2017 at 21:11

2 Answers 2

1

If I understand correctly the problem is only 5 clients can connect to an ESP8266 at any one time. This is an early morning solution to the problem and to be honest I haven't though it through that much, but hopefully its a starting point.

Rather than having all the clients in the mesh connect to the Master node, run an aggregation service on the slaves. One slave will accept connections fro up to 4 other slaves and it will forward the data to the master. If you ever wanted more than 5 slave nodes you would need to have the aggregator nodes feeding into another aggregator (like a tree structure). Its quite easy to do statically, but could be tricky if you wanted to do it dynamically. These aggregators might need to be dedicated nodes, it depends on traffic.

That leaves the master 4 connections for clients. If that isn't enough then you could send the data from the master to additional ESP8266s acting as dedicated webservers and get the clients to connect to them instead. There may even be a method of sharing the load between these two web servers in the same way as proper servers do.

4
  • 1
    i get that. evry esp8266 get 5 client so i can have 15 client but problem is connection between esp8266 models if i us tcp for connection, my master esp lost 2 space of clients. master model is in center of my place and most clients using that
    – Ronix3
    Nov 21, 2017 at 11:19
  • I think you got half of it. The master ONLY talks to one ESP, (lets call it slave1) Slave1 is a sensor and server, it forwards data from Slave2, Slave3, etc to the Master and from the master back to the Slaves. I'm not sure if Slave2 will be able to be a sensor and a server, so it might need to be an extra ESP. Another plan might be to look at ESP32, it will cost about 5x what a 8266 costs (~£5), but it might support more clients (Its dual core and has more RAM) Nov 21, 2017 at 11:25
  • tnx fo your try to help. i'am thinking about beter slution
    – Ronix3
    Nov 21, 2017 at 15:27
  • i read some where that max client can up to 255 i think about this
    – Ronix3
    Nov 21, 2017 at 16:53
0

You don't need a separate socket for every client. A client connects to server, sends data or gets data and disconnects. Then the next client connects. One server and one client at the time plus one client connection to PC.

4
  • i need clients be conected
    – Ronix3
    Nov 21, 2017 at 3:25
  • whats the difference? why is the keep alive of the connection important for you?
    – Juraj
    Nov 21, 2017 at 5:16
  • It depends on the frequency of the packets you are sending, to often and the connection overhead will be ridiculous. Also there is no guarantee that you won't have a situation where all the available connections are used, because all devices and clients are connected. Nov 21, 2017 at 8:10
  • i want send online status to clients so i need cients be alive
    – Ronix3
    Oct 28, 2018 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.