Click or drag to resize

12.4.2 How to Connect to a Card using a Hostname or Explicit Address

This procedure for making contact with a particular SP-ICE-3 Card from your application assumes that you already know the card's IP Address.

Please refer to 5.5.2.3 How to obtain Card IP-Addresses the Hard Way.

Making contact with a card using its IP Address.

Assuming we have armed ourselves with the card's address, we can attempt to make contact with it like this:

Note  Note
  • Boilerplate code is omitted from this example for brevity: please refer to 12.3 Example Code in this Manual.

  • This example is deliberately simplistic (some might say simple minded) to illustrate a point.

    It is not intended as an example of good programming style, nor of good programming practice.

C#
using ( ClientAPI client = new ClientAPI() )
{
    // NB: we assume the existence of a variable called CardIP,
    // which contains the IP address of our card.

    // Open a communications channel to the card:
    client.Connect( CardIP );
    if ( client.Connected )
    {
        // Send a command to the card:
        string serialNumber = client.System.GetCardSerialNumber();

        Console.WriteLine( "Connected to SN {0} at {1}", serialNumber, CardIP );

        // Close the communications channel to the card:
        client.Disconnect();
    }
}
See Also