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);
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.