static void Main(string[] args) { //Create Network media component and start listen events. //4059 is Official DLMS port. try { /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN SNServer = new GXDLMSServerSN(); SNServer.Initialize(4060); Console.WriteLine("Short Name DLMS Server in port 4060."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN LNServer = new GXDLMSServerLN(); LNServer.Initialize(4061); Console.WriteLine("Logical Name DLMS Server in port 4061."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN_47 SN_47Server = new GXDLMSServerSN_47(); SN_47Server.Initialize(4062); Console.WriteLine("Short Name DLMS Server with IEC 62056-47 in port 4062."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN_47 LN_47Server = new GXDLMSServerLN_47(); LN_47Server.Initialize(4063); Console.WriteLine("Logical Name DLMS Server with IEC 62056-47 in port 4063."); while (Console.ReadKey().Key != ConsoleKey.Enter); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { //Create Network media component and start listen events. //4059 is Official DLMS port. try { /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN SNServer = new GXDLMSServerSN(); SNServer.Initialize(4060); Console.WriteLine("Short Name DLMS Server in port 4060."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN LNServer = new GXDLMSServerLN(); LNServer.Initialize(4061); Console.WriteLine("Logical Name DLMS Server in port 4061."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN_47 SN_47Server = new GXDLMSServerSN_47(); SN_47Server.Initialize(4062); Console.WriteLine("Short Name DLMS Server with IEC 62056-47 in port 4062."); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN_47 LN_47Server = new GXDLMSServerLN_47(); LN_47Server.Initialize(4063); Console.WriteLine("Logical Name DLMS Server with IEC 62056-47 in port 4063."); while (Console.ReadKey().Key != ConsoleKey.Enter) { ; } //Close servers. SNServer.Close(); LNServer.Close(); SN_47Server.Close(); LN_47Server.Close(); Console.WriteLine("Servers closed."); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static int Main(string[] args) { try { Settings settings = new Settings(); int ret = Settings.GetParameters(args, settings); if (ret != 0) { return(ret); } if (settings.serial != null) { GXDLMSBase server; if (settings.useLogicalNameReferencing) { server = new GXDLMSServerLN(); Console.WriteLine("Logical Name DLMS Server in serial port {0}.", settings.serial); } else { server = new GXDLMSServerSN(); Console.WriteLine("Short Name DLMS Server in serial port {0}.", settings.serial); } try { server.Initialize(settings.serial, settings.trace); } catch (System.IO.IOException ex) { Console.WriteLine("----------------------------------------------------------"); Console.WriteLine(ex.Message); Console.WriteLine("Available ports:"); Console.WriteLine(string.Join(" ", Gurux.Serial.GXSerial.GetPortNames())); return(1); } Console.WriteLine("----------------------------------------------------------"); ConsoleKey k; while ((k = Console.ReadKey().Key) != ConsoleKey.Escape) { if (k == ConsoleKey.Delete) { Console.Clear(); } Console.WriteLine("Press Esc to close application or delete clear the console."); } //Close servers. server.Close(); } else { //Create Network media component and start listen events. //4059 is Official DLMS port. /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN SNServer = new GXDLMSServerSN(); SNServer.Initialize(settings.port, settings.trace); Console.WriteLine("Short Name DLMS Server in port {0}.", settings.port); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -r sn -h localhost -p {0}", settings.port); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN LNServer = new GXDLMSServerLN(); LNServer.Initialize(settings.port + 1, settings.trace); Console.WriteLine("Logical Name DLMS Server in port {0}.", settings.port + 1); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -h localhost -p {0}", settings.port + 1); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN_47 SN_47Server = new GXDLMSServerSN_47(); SN_47Server.Initialize(settings.port + 2, settings.trace); Console.WriteLine("Short Name DLMS Server with IEC 62056-47 in port {0}.", settings.port + 2); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -r sn -h localhost -p {0} -w", settings.port + 2); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN_47 LN_47Server = new GXDLMSServerLN_47(); LN_47Server.Initialize(settings.port + 3, settings.trace); Console.WriteLine("Logical Name DLMS Server with IEC 62056-47 in port {0}.", settings.port + 3); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -h localhost -p {0} -w", settings.port + 3); Console.WriteLine("----------------------------------------------------------"); Console.WriteLine("Server System title: {0}", GXDLMSTranslator.ToHex(LNServer.Ciphering.SystemTitle)); Console.WriteLine("Authentication key: {0}", GXDLMSTranslator.ToHex(LNServer.Ciphering.AuthenticationKey)); Console.WriteLine("Block cipher key: {0}", GXDLMSTranslator.ToHex(LNServer.Ciphering.BlockCipherKey)); Console.WriteLine("Client System title: {0}", GXDLMSTranslator.ToHex(LNServer.ClientSystemTitle)); Console.WriteLine("Master key (KEK) title: {0}", GXDLMSTranslator.ToHex(LNServer.Kek)); Console.WriteLine("----------------------------------------------------------"); Thread t = new Thread(() => DoWork(SNServer)); t.Start(); t = new Thread(() => DoWork(LNServer)); t.Start(); t = new Thread(() => DoWork(SN_47Server)); t.Start(); t = new Thread(() => DoWork(LN_47Server)); t.Start(); ConsoleKey k; while ((k = Console.ReadKey().Key) != ConsoleKey.Escape) { if (k == ConsoleKey.Delete) { Console.Clear(); } Console.WriteLine("Press Esc to close application or delete clear the console."); } //Close servers. SNServer.Close(); LNServer.Close(); SN_47Server.Close(); LN_47Server.Close(); Console.WriteLine("Servers closed."); } return(0); } catch (Exception ex) { Console.WriteLine(ex.Message); return(1); } }
static int Main(string[] args) { //Create Network media component and start listen events. //4059 is Official DLMS port. Settings settings = new Settings(); int ret = GetParameters(args, settings); if (ret != 0) { return(ret); } try { if (settings.serial != null) { GXDLMSServerLN LNServer = new GXDLMSServerLN(); LNServer.Initialize(settings.serial, settings.trace); Console.WriteLine("Logical Name DLMS Server in serial port {0}.", settings.serial); Console.WriteLine("----------------------------------------------------------"); ConsoleKey k; while ((k = Console.ReadKey().Key) != ConsoleKey.Escape) { if (k == ConsoleKey.Delete) { Console.Clear(); } Console.WriteLine("Press Esc to close application or delete clear the console."); } //Close servers. LNServer.Close(); } else { /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN SNServer = new GXDLMSServerSN(); SNServer.Initialize(settings.port, settings.trace); Console.WriteLine("Short Name DLMS Server in port {0}.", settings.port); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -r sn -h localhost -p {0}", settings.port); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN LNServer = new GXDLMSServerLN(); LNServer.Initialize(settings.port + 1, settings.trace); Console.WriteLine("Logical Name DLMS Server in port {0}.", settings.port + 1); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -h localhost -p {0}", settings.port + 1); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerSN_47 SN_47Server = new GXDLMSServerSN_47(); SN_47Server.Initialize(settings.port + 2, settings.trace); Console.WriteLine("Short Name DLMS Server with IEC 62056-47 in port {0}.", settings.port + 2); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -r sn -h localhost -p {0} -w", settings.port + 2); Console.WriteLine("----------------------------------------------------------"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. GXDLMSServerLN_47 LN_47Server = new GXDLMSServerLN_47(); LN_47Server.Initialize(settings.port + 3, settings.trace); Console.WriteLine("Logical Name DLMS Server with IEC 62056-47 in port {0}.", settings.port + 3); Console.WriteLine("Example connection settings:"); Console.WriteLine("Gurux.DLMS.Client.Example.Net -h localhost -p {0} -w", settings.port + 3); ConsoleKey k; while ((k = Console.ReadKey().Key) != ConsoleKey.Escape) { if (k == ConsoleKey.Delete) { Console.Clear(); } Console.WriteLine("Press Esc to close application or delete clear the console."); } //Close servers. SNServer.Close(); LNServer.Close(); SN_47Server.Close(); LN_47Server.Close(); Console.WriteLine("Servers closed."); } return(0); } catch (Exception ex) { Console.WriteLine(ex.Message); return(1); } }