locked
About the time-out detection RRS feed

  • Question

  • User207418774 posted

    Dears,

     I'm developing a ISAP extension, this extension's function is

    1, Accept the Client request

    2, Format the request to backend server to processing

    3, Got the backend server processing result, as response to client

     

    There is a problem now, If one connection is timeout, i will need notice the backend server the connection timeout, no need to handle it.

     But i didn't know how to get one connection's status, anybody can tell me how to detect the connection is time out?

    Thanks very much

    Wednesday, January 2, 2008 2:40 AM

Answers

  • User511787461 posted

    That usage is incorrect, it should be used like so

    if (!pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_IS_CONNECTED, &fConnected, NULL, 0) || !fConnected)

         not connected;

    else

         connected;

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, January 3, 2008 2:43 PM

All replies

  • User511787461 posted

    You can use HSE_REQ_IS_CONNECTED to poll for whether client is still connected - there is no mechanism for async notification.

    Wednesday, January 2, 2008 2:57 AM
  • User207418774 posted

    Thanks very much for you quick answer.

    To enhance the ISAPI process performance, In fact i use a thread pool to accept the request and then push it to the backend server processing, after processed, the result response to client. In that case, can use HSE_REQ_IS_CONNECTED to detect the timeout occurred?<!---->

     

    Wednesday, January 2, 2008 3:16 AM
  • User511787461 posted

    Yes, you can use HSE_REQ_IS_CONNECTED from any thread before you call HSE_REQ_DONE_WITH_SESSION.

    Wednesday, January 2, 2008 2:37 PM
  • User207418774 posted

    Thanks very much.

    I use the method your provide to have a test.

    1) Write a ISAPI test program.

    A part is:

     try
     {
      if (pCtxt->m_pECB->ServerSupportFunction(pCtxt->m_pECB->ConnID, HSE_REQ_IS_CONNECTED,
      NULL, NULL, 0)==TRUE)
      {
       OutputDebugString("Connection alive.");
      }
      else
       OutputDebugString("Connection disconnected.");
     }
     catch (...)
     {
      OutputDebugString("Exception occured.");
     }

    2) Deploy it in the IIS, the IIS timeout set as 60 seconds.

    3) Use IE to request the ISAPI, and in server side ,Use DbgView to check the running result

     The result is so strange:

    1, IE can get the response message

    2, The Dbgview output the Connection disconnected.

     

    Why does this happen?

    Wednesday, January 2, 2008 8:20 PM
  • User207418774 posted

    I found the problem, because i use the function wrong. Now i can get is the connection is alive or disconnected. 

    try
     {
      if (pCtxt->m_pECB->ServerSupportFunction(pCtxt->m_pECB->ConnID, HSE_REQ_IS_CONNECTED,
      NULL, NULL, 0)==TRUE)
      {
       OutputDebugString("Connection alive.");
      }
      else
       OutputDebugString("Connection disconnected.");
     }
     catch (...)
     {
      OutputDebugString("Exception occured.");
     }

    Wednesday, January 2, 2008 10:52 PM
  • User511787461 posted

    That usage is incorrect, it should be used like so

    if (!pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_IS_CONNECTED, &fConnected, NULL, 0) || !fConnected)

         not connected;

    else

         connected;

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, January 3, 2008 2:43 PM
  • User207418774 posted

     Yes, you are right, thanks.

    Thursday, January 3, 2008 8:43 PM