DevicesManager.Connect Method (TimeSpan)

 

Connects the devices manager to the devices provider with the specified timeout period.

Namespace:   Microsoft.WindowsServerSolutions.Common.Devices
Assembly:  DevicesOM (in DevicesOM.dll)

Syntax

public void Connect(
    TimeSpan timeout
)
public:
void Connect(
    TimeSpan timeout
)
Public Sub Connect (
    timeout As TimeSpan
)

Parameters

  • timeout
    Type: System.TimeSpan

    Specifies the timeout period for the connection.

Examples

The following code example shows how to connect the devices manager to the devices provider with the specified time-out period.

// timeout after 5 seconds
TimeSpan timeOut = TimeSpan.FromSeconds(5); 
try
{
   DevicesManager dm = new DevicesManager();
   dm.Connect(timeOut);
   Console.WriteLine("Connection established.");
}
catch (TimeoutException)
{
   Console.WriteLine("Failed to establish connection before timeout.");
}

See Also

Connect Overload
DevicesManager Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace

Return to top