2014-12-01 10:34:45 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using IEC61850.Client;
|
|
|
|
using IEC61850.Common;
|
|
|
|
|
|
|
|
namespace authenticate
|
|
|
|
{
|
|
|
|
class MainClass
|
|
|
|
{
|
|
|
|
public static void Main (string[] args)
|
|
|
|
{
|
|
|
|
IedConnection con = new IedConnection ();
|
|
|
|
|
|
|
|
string hostname;
|
|
|
|
|
|
|
|
if (args.Length > 0)
|
|
|
|
hostname = args[0];
|
|
|
|
else
|
|
|
|
hostname = "localhost";
|
|
|
|
|
|
|
|
Console.WriteLine("Connect to " + hostname);
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
IsoConnectionParameters parameters = con.GetConnectionParameters();
|
|
|
|
|
|
|
|
parameters.UsePasswordAuthentication("top secret");
|
|
|
|
|
|
|
|
con.Connect(hostname, 102);
|
|
|
|
|
|
|
|
List<string> serverDirectory = con.GetServerDirectory(false);
|
|
|
|
|
|
|
|
foreach (string entry in serverDirectory)
|
|
|
|
{
|
|
|
|
Console.WriteLine("LD: " + entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
con.Release();
|
|
|
|
}
|
|
|
|
catch (IedConnectionException e)
|
|
|
|
{
|
|
|
|
Console.WriteLine(e.Message);
|
|
|
|
}
|
2015-10-27 17:13:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
// release all resources - do NOT use the object after this call!!
|
|
|
|
con.Dispose ();
|
2014-12-01 10:34:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|