Re: Detecting broken connection to Sybase server.



Thanks for you suggestion. I made some change to my code to something
similar to the following. However, the ct_con_props still reset status
to 0. Did I get you right?

Thanks
Andy


if ( CS_FAIL == (nRetVal = ct_send(m_pCmd) ) )
{
ct_cancel(NULL, m_pCmd, CS_CANCEL_ALL) ;

CS_INT status = CS_CONSTAT_DEAD;
ct_con_props(m_pDatabase->pCnx, CS_GET, CS_CON_STATUS,
NULL, 0, &status);

if(status & CS_CONSTAT_DEAD)
{
// connection failed!
}
}

// make sure that send worked OK
if (CS_FAIL == (nRetVal = ct_results( m_pCmd, &nRetVal2) ) )
{
ct_cancel(NULL, m_pCmd, CS_CANCEL_ALL) ;

CS_INT status = CS_CONSTAT_DEAD;
ct_con_props(m_pDatabase->pCnx, CS_GET, CS_CON_STATUS,
NULL, 0, &status);

if(status & CS_CONSTAT_DEAD)
{
// connection failed!
}
}

.



Relevant Pages