Update ConnectionCallBack from example serve1 with clientConnection.Abort()

v1.6
Maxson Ramon dos Anjos Medeiros 1 month ago
parent d1dd90ed83
commit 435ad8d01a

@ -101,22 +101,16 @@ namespace server1
void ConnectionCallBack(IedServer server, ClientConnection clientConnection, bool connected, object parameter) void ConnectionCallBack(IedServer server, ClientConnection clientConnection, bool connected, object parameter)
{ {
string allowedIp = parameter as string; string allowedIp = parameter as string;
string ipAddress = clientConnection.GetPeerAddress(); string ipAddress = clientConnection.GetLocalAddress();
if (allowedIp == ipAddress) if (allowedIp != ipAddress)
{ {
clientConnection.Abort();
} }
else
{
}
} }
var connectionCallBack = new ConnectionIndicationHandler(ConnectionCallBack); var connectionCallBack = new ConnectionIndicationHandler(ConnectionCallBack);
iedServer.SetConnectionIndicationHandler(connectionCallBack, "127.0.0.2"); iedServer.SetConnectionIndicationHandler(connectionCallBack, "127.0.0.1:103");
iedServer.Start(102); iedServer.Start(102);

Loading…
Cancel
Save