View Single Post

   
  #1 (permalink)  
Old 04-08-2008, 06:01 PM
seamonster76@yahoo.com
 
Posts: n/a
Default Detecting broken connection to Sybase server.

Hi,

I believe I am supposed to use ct_con_props in order to check the
connection status.

My program looks like the following...

// send command to the database
if ( CS_FAIL == (nRetVal = ct_send(m_pCmd) ) )
{
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)
{
// Broken connection...
}
}

// make sure that send worked OK
if (CS_FAIL == (nRetVal = ct_results( m_pCmd, &nRetVal2) ) )
{
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)
{
// Broken connection...
}
}


After I unplug the network cable, ct_results and ct_send return CS_FAIL
as expected. However, the ct_con_props reset the status to 0, instead
of indicating the connection is dead by setting the bitmap.

Did I do anything wrong or was I missing something?

Thanks for any help.
Andy

Reply With Quote