private static bool IsTcpIpConnectionError(SqlException exception)
{
return exception.Class == 20 && (
exception.Number == 64 || // A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)
exception.Number == 10053 || // ConnectionAborted - A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.)
exception.Number == 10054 || // ConnectionReset
exception.Number == 10061 || // ConnectionRefused
false);
}