如何检测会话是否有效或已过期?

时间:2021-12-11 07:16:04

Is there a call I can make to determine whether my session is still alive in a gsoap client?

我是否可以通过电话来确定我的会话是否仍然在gsoap客户端中存在?

The only way I see to check if a session is still alive is to check to see if all the cookie values match after each soap call. It seems like gsoap would be aware of the session being alive since the tcp_keep_alive flag is set. Is there functionality in gsoap that would allow me to check this before a soap call? Is there a callback that will inform me of session loss? Or should I just make a dummy soap method for this purpose?

我看到检查会话是否仍然存在的唯一方法是检查每个soap调用后是否所有cookie值都匹配。由于设置了tcp_keep_alive标志,gsoap似乎会意识到会话处于活动状态。 gsoap中是否有功能允许我在肥皂呼叫之前检查这个功能?是否有回调会告诉我会话丢失?或者我应该为此目的制作一个虚拟肥皂方法?

1 个解决方案

#1


0  

You can use Genivia Plugin ,to Ckeck and create or update a session on localhost:8080 that is valid on any path:

您可以使用Genivia插件,Ckeck并在localhost:8080上创建或更新在任何路径上有效的会话:

soap->cookie_domain = "localhost:8080";
struct soap_session *session = soap_start_session(soap, NULL, NULL); 

To create a new session variable or modify an existing session variable inside that session:

要创建新的会话变量或修改该会话中的现有会话变量,请执行以下操作:

soap_set_session_var(soap, "session_var_name", "session_var_value", NULL, NULL);

To access the value of that session variable:

要访问该会话变量的值:

const char *value = soap_get_session_var(soap, "session_var_name", NULL, NULL);

To delete that session variable:

要删除该会话变量:

soap_clr_session_var(soap, "session_var_name", NULL, NULL); 

#1


0  

You can use Genivia Plugin ,to Ckeck and create or update a session on localhost:8080 that is valid on any path:

您可以使用Genivia插件,Ckeck并在localhost:8080上创建或更新在任何路径上有效的会话:

soap->cookie_domain = "localhost:8080";
struct soap_session *session = soap_start_session(soap, NULL, NULL); 

To create a new session variable or modify an existing session variable inside that session:

要创建新的会话变量或修改该会话中的现有会话变量,请执行以下操作:

soap_set_session_var(soap, "session_var_name", "session_var_value", NULL, NULL);

To access the value of that session variable:

要访问该会话变量的值:

const char *value = soap_get_session_var(soap, "session_var_name", NULL, NULL);

To delete that session variable:

要删除该会话变量:

soap_clr_session_var(soap, "session_var_name", NULL, NULL);