I have a server on my arduino (WiFi) and want to save the clients that connect, so that I can send to them (to each separately) data later.
The question (and some of the answers) seem to misunderstand how HTTP works. I know how it works (at least to an extent) as I have written server scripts in Lua, as well as C++ for the Arduino.
As I mention in my page about an Arduino HTTP server when the client initiates a request it sends an HTTP header along these lines:
POST /forum/showpost.php?id=12345&page=2 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0)
Host: www.example.com
Cookie: foo=bar;
Accept-Language: en, mi
action=save&user_id=1234
Breaking those parts down you get this:

Once the client has sent the request it awaits (on the same connection) for the server to respond. The response may look something like this:
HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
Server: HTTPserver/1.0.0 (Arduino)
<!DOCTYPE html>
<html>
<head>
<title>Arduino test</title>
</head>
<body>
<h1> My heading </h1>
<p>Some text
</body>
</html>
Notice the blank line between the HTTP header and the actual file data (the HTML data).
Under HTTP 1.1 the server can request that the connection keep open the connection by replacing:
Connection: close
by:
Connection: keep-alive
All this means is that the client is still connected and can now request other stuff (for example an image from an <img>
tag). It does that by sending another HTTP header and then getting another response. It doesn't keep the connection open just so that the server can randomly send other stuff in the future.
Note: - the default under HTTP 1.1 is for the connections to be persistent.
... so that I can send to them (to each separately) data later.
You don't "send data later", that's not how it works. The client may request data later.
The standard way of keeping track of clients which are doing stuff (like filling in a series of forms) is to use cookies - that is what they are for. The server sends a cookie, the client remembers it, and sends it back with the next request. The cookie identifiers that it is the same client as before, and what it was doing. For example, a cookie might contain a token to indicate that you have logged in.