Electrical – single and multi connection mode( AT+CIPMUX=0 or 1) in esp8266 AT commands

at commandsembeddedesp8266software

I was studying the AT commands to program atmega328p for the communication with esp8266. Now I am confused with the command AT+CIPMUX=0 or 1 , it explains that 1 for multiple connection, 0 for single connection.

I don't understand the single and multiple connection.
Actually, what is the difference between them?

Best Answer

By default, the ESP is in "single connection mode". This means that, at any time, there can only be one TCP connection. (UDP actually has no concept of a "connection", but the ESP still handles it like one.) This single connection must be terminated (closed) before a new connection (from/to the same or a different remote IP address) can be opened.

In "multi connection mode" (CIPMUX=1) the ESP can maintain up to five different connections (from/to the same or different remote IP addresses) at the same time. There is no need to close one connection before starting another, as long as there are no more than five open at the same time.

Especially when acting as a server this feature is useful because with single connection mode the server cannot accept any new request while one client is connected. So as long as one client is being served whatever data, any other connection request will be rejected.

For example, if you serve a webpage from the ESP, even a single browser will likely try and establish a couple of connections concurrently to speed up loading of images, scripts and other resources referenced by the HTML page. If the ESP is in single connection mode, it is likely that those concurrent connection requests will be rejected and the browser will have to retry the connection until the ESP has served and closed any previous connection.

Needless to say that when you have multiple clients you usually don't want to reject connections because there currently is already one client being served.

Related Topic