Closed SDK Connection Exception

I have a conexion to api but i want to handled the exception ConnectionClosedException (cause is taking too long if the api is offline or is 504 GetAwayTimeOut Problem, but i get unhadled exception anyways…

try
{
//Connecting to api but it takes too long cause is not available
}
catch (RemObjects.SDK.Exceptions.ConnectionClosedException ex)
{
res.Valida = false;
res.Mensaje = ex.Message;
}
catch (WebException ex)
{
res.Valida = false;
res.Mensaje = ex.Message;
}

Or how increase the ConnectionPoolTimeOut? I have in program.cs:

public static int Main(string[] args)
{

        ApplicationServer server = new ApplicationServer("RPServicioLeal");

        server.NetworkServer.Port = Convert.ToInt32(RPComun.utileriasComun.readSetting("Port", "8060"));
        server.Run(args);
        return 0;
    }

Hello

Sorry for the belated answer. You can fine-tune the server channel options using code like

		public static int Main(string[] args)
		{
			ApplicationServer server = new ApplicationServer("ROServer5");

			var channel = new IpHttpServerChannel();
			//channel.HttpServer.Timeout = ...
			//channel.HttpServer.TimeoutEnabled ...
			server.NetworkServer.ServerChannel = channel;
			server.NetworkServer.Port = 8099;

			server.Run(args);
			return 0;
		}

Regards