Go Down

Topic: Concurrent Clients - Session State (Read 513 times) previous topic - next topic

mtruijen

I have started using the Ethernet library. I am still in the process of understanding its implementation.

How are connected clients serialized? If 2 clients are connected at the same time, how do I know which one I am communicating with?
When a client connects and submits a form, I want to make sure that I can isolate the communication between the server and client without interference of another client.

Depending on the implementation of the Ethernet library, I would either want to handle clients in serial or parallel (if possible).

johnwasser

Generally a web server will provide session memory by placing a cookie on the web browser.  That cookie will be returned with each web request.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

PaulS

While multiple clients can connect to the Arduino-as-server at one time, only one is processed on any given pass through loop. The entire transaction with that client is completed on that pass through loop. So, there is never any ambiguity about which client you are dealing with.

Client/server communication is stateless. The server has no clue, unless the client takes action, that it has ever seen a client before. Having the client send some kind of ID to the server, so the server can say "Hey, I've seen you before" is possible, but not really a good idea (on the Arduino). It is better to treat each client as a new, never before seen, client.

mtruijen


Go Up