ConnectTimeoutException
public sealed class ConnectTimeoutException : ThermalDeviceException
The open ran out of the time it was allowed, with nothing answering at the address.
A subclass of ThermalDeviceException, so every existing catch (ThermalDeviceException) keeps catching it and no application that already handled a failed open changes behaviour. Catch this one first to tell the two apart.
The distinction it exists for. A refusal comes back at once and means something is at that address: a host that is not a camera, or a camera that would not have you. An expiry means nothing answered at all. An operator fixes those differently: one is a wrong address, the other is a cable, a firewall or a subnet. An application that cannot tell them apart can only say "could not connect", which is the report this type exists to prevent.
Only a network camera can raise it. One on USB has no connection to time out; it is there or it is not.
Nothing is left open. The camera is not claimed, no handle was produced, and the next attempt on the same address starts from nothing, unlike cancelling an open, which leaves the SDK finishing it on its own thread.
Example
var options = new CameraOptions { ConnectTimeout = TimeSpan.FromSeconds(2), }; try { await using var camera = await ThermalCamera.OpenAsync(device, options, phases, token); } catch (ConnectTimeoutException) { status.Text = $"Nothing answered at {device.Address}. " + "Check the cable, the subnet and the firewall."; } catch (ThermalDeviceException error) { // Something was there and the open still failed. status.Text = error.Message; }
ConnectTimeoutException: constructors
public ConnectTimeoutException(string message)
Create the exception.
message: What went wrong.
public ConnectTimeoutException(string message, int status)
Create the exception with its native status.
message: What went wrong.status: The native status code.