The http_get_session returns the current session number of
the HTTP server running on TCPnet. The session number can be any
value between 0 and HTTP_NUMSESS. You can customize the defined value
of HTTP_NUMSESS in net_config.h.
The http_get_session function is a system function that is
in the RL-TCPnet library. The prototype is defined in
net_config.h.
note
Storing the HTTP query string in a single global variable can
result in the HTTP server sending the wrong reply to a client when
several clients try to access a dynamic HTTP page at the same time.
Hence it is better to have a separate variable for each session,
for example an array of query strings.
Return Value
The http_get_session function returns the current session
number of the HTTP server.
/* Should be the same value as set in 'Net_Config.c' file. */
#define HTTP_NUMSESS 10
U32 answer[HTTP_NUMSESS];
U16 cgi_func (U8 *env, U8 *buf, U16 buflen, U32 *pcgi) {
U16 len = 0;
U32 http_session;
..
http_session = http_get_session ();
len += sprintf (buf+len,"Answer is: %d",answer[http_session]);
..
return (len);
}
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.