forked from mz-automation/libiec61850
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cs
51 lines (38 loc) · 1.13 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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);
}
// release all resources - do NOT use the object after this call!!
con.Dispose ();
}
}
}