ConnectionNotMadeException Class |
This exception can be thrown by the Connect method to indicate that the connection could not be established.
Public Instance Constructors
|
Overloaded. Initializes a new instance of the ConnectionNotMadeException class. |
Public Instance Properties
|
|
Gets or sets a link to the help file associated with this exception. |
|
|
Gets the Exception instance that caused the current exception. |
|
|
Gets a message that describes the current exception. |
|
|
Gets or sets the name of the application or the object that causes the error. |
|
|
Gets a string representation of the frames on the call stack at the time the current exception was thrown. |
|
|
Gets the method that throws the current exception. |
Public Instance Methods
|
|
Determines whether the specified Object is equal to the current Object. |
|
|
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. |
|
|
Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. |
|
|
When overridden in a derived class, sets the SerializationInfo with information about the exception. |
|
|
Gets the Type of the current instance. |
|
|
Creates and returns a string representation of the current exception. |
The following code example illustrates the basic use of the ConnectionNotMadeException class:
|
Visual Basic |
Imports RMCLinkNET
Module Module1
Sub Main()
Try
Dim rmc As RMCLink = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.10")
Console.WriteLine("Connecting...")
rmc.Connect()
Try
Dim data() As Single = New Single(0) {}
Console.WriteLine("Reading Axis 0 Actual Position...")
rmc.ReadFFile(FileNumber70.fn70StatusAxis0, 8, data, 0, 1)
Console.WriteLine(String.Format(" ActPos: {0:F3}", data(0)))
Console.WriteLine("Done")
Finally
rmc.Disconnect()
End Try
Catch ex As ConnectionNotMadeException
Console.WriteLine("Unable to connect to the controller. " & ex.Message)
Catch ex As ReadWriteFailedException
Console.WriteLine("Unable to read from the controller. " & ex.Message)
End Try
End Sub
End Module
|
|
C# |
using System;
using RMCLinkNET;
namespace Example
{
public class Program
{
static void Main()
{
try
{
RMCLink rmc = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.10");
Console.WriteLine("Connecting...");
rmc.Connect();
try
{
float[] data = new float[1];
Console.WriteLine("Reading Axis 0 Actual Position...");
rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0, 8, data, 0, 1);
Console.WriteLine(String.Format(" ActPos: {0:F3}", data[0]));
Console.WriteLine("Done");
}
finally
{
rmc.Disconnect();
}
}
catch (ConnectionNotMadeException e)
{
Console.WriteLine("Unable to connect to the controller. " + e.Message);
}
catch (ReadWriteFailedException e)
{
Console.WriteLine("Unable to read from the controller. " + e.Message);
}
}
}
}
|
|
C++/CLI |
using namespace System;
using namespace RMCLinkNET;
int main()
{
try
{
RMCLink^ rmc = RMCLink::CreateEthernetLink(DeviceType::RMC70, "192.168.0.10");
Console::WriteLine("Connecting...");
rmc->Connect();
try
{
array<float>^ data = gcnew array<float>(1);
Console::WriteLine("Reading Axis 0 Actual Position...");
rmc->ReadFFile((int)FileNumber70::fn70StatusAxis0, 8, data, 0, 1);
Console::WriteLine(String::Format(" ActPos: {0:F3}", data[0]));
Console::WriteLine("Done");
}
finally
{
rmc->Disconnect();
}
}
catch (ConnectionNotMadeException^ e)
{
Console::WriteLine("Unable to connect to the controller. " + e->Message);
}
catch (ReadWriteFailedException^ e)
{
Console::WriteLine("Unable to read from the controller. " + e->Message);
}
return 0;
}
|
Requirements
Namespace: RMCLinkNET
Assembly: RMCLink.Interop (in RMCLink.Interop.dll)
See Also
RMCLink.Interop .NET Assembly | RMCLink Class
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion