Re: Detecting broken connection to Sybase server. Hello,
Unplugging the network cable does not mean the connection is dead. If
you plug it back in before certain TCP kernel parameters expire, the
connection might still be useable. On Solaris, these parameters are:
tcp_ip_abort_cinterval
Abort timeout at connect time.
This is the 3-way handshake abort timer.
The default value is 180000 (3 MIN)
tcp_ip_abort_interval
Abort interval used after connected (abort timeout for an established
connection)
This is the maximum time TCP retransmits will be tried for a
connection
in the ESTABLISHED state should be tried before a RESET segment is
sent.
Default 480000 (8*MINUTES)
So you would have to wait about 8 minutes before TCP told Sybase that
the
connection was dead.
I would not suggest checking the CS_CON_STATUS after each command
because there are plenty of other reasons for ct_send or ct_results to
fail.
Ideally, you would use set CS_TIMEOUT so that your command times out.
Then in your error handler, you try to ct_cancel() the connection and
possibly
checking the connection property. |