- .NET API: fixed server side bug with connection indication handler
This commit is contained in:
parent
5358ef28c3
commit
e6b8e09e91
3 changed files with 16 additions and 3 deletions
|
@ -779,11 +779,15 @@ namespace IEC61850
|
|||
// }
|
||||
//}
|
||||
|
||||
private InternalConnectionHandler internalConnectionHandler = null;
|
||||
|
||||
/// <summary>Start MMS server</summary>
|
||||
public void Start(int tcpPort)
|
||||
{
|
||||
IedServer_setConnectionIndicationHandler (self, connectionIndicationHandler, IntPtr.Zero);
|
||||
if (internalConnectionHandler == null)
|
||||
internalConnectionHandler = new InternalConnectionHandler (connectionIndicationHandler);
|
||||
|
||||
IedServer_setConnectionIndicationHandler (self, internalConnectionHandler, IntPtr.Zero);
|
||||
|
||||
IedServer_start(self, tcpPort);
|
||||
}
|
||||
|
@ -801,6 +805,7 @@ namespace IEC61850
|
|||
public void Stop()
|
||||
{
|
||||
IedServer_stop(self);
|
||||
internalConnectionHandler = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -811,6 +816,7 @@ namespace IEC61850
|
|||
{
|
||||
IedServer_destroy(self);
|
||||
self = IntPtr.Zero;
|
||||
internalConnectionHandler = null;
|
||||
}
|
||||
|
||||
public bool IsRunning()
|
||||
|
|
|
@ -17,14 +17,19 @@ namespace example1
|
|||
if (args.Length > 0)
|
||||
hostname = args[0];
|
||||
else
|
||||
hostname = "10.0.2.2";
|
||||
hostname = "127.0.0.1";
|
||||
|
||||
int port = 102;
|
||||
|
||||
if (args.Length > 1)
|
||||
port = Int32.Parse(args [1]);
|
||||
|
||||
Console.WriteLine("Connect to " + hostname);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
con.Connect(hostname, 102);
|
||||
con.Connect(hostname, port);
|
||||
|
||||
List<string> serverDirectory = con.GetServerDirectory(false);
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace server1
|
|||
iedServer.Start (102);
|
||||
Console.WriteLine ("Server started");
|
||||
|
||||
GC.Collect ();
|
||||
|
||||
while (running) {
|
||||
Thread.Sleep (1);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue