Sometimes a server needs some session management to keep track of the clients involved. One solution would be, to add an extra parameter representing some unique identifier to each method invocation and return value. But this means additional work for each possible method call.
A more convenient solution when using HTTP as transportation media is to apply cookie management. In this case the server checks the incoming HTTP header for a special line with session information. This is called a cookie. If the information is missing, the server adds one to the response. The client is then expected to store the cookie and add it to further requests if appropriate.
TcpIpConnection conn (true, host, port); HttpProtocol prot(&conn); prot.setAcceptCookies(true); if (prot.hasCookie()) prot.getCookie(); prot.setServerCookie("cookie-test=123");
Enable cookie managent. Otherwise cookies are completely ignored.
Check for incoming cookie information and use it.
Add a cookie to further responses over this protocol object.