Program.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /******************************************************************************
  2. ** Copyright (c) 2006-2018 Unified Automation GmbH All rights reserved.
  3. **
  4. ** Software License Agreement ("SLA") Version 2.7
  5. **
  6. ** Unless explicitly acquired and licensed from Licensor under another
  7. ** license, the contents of this file are subject to the Software License
  8. ** Agreement ("SLA") Version 2.7, or subsequent versions
  9. ** as allowed by the SLA, and You may not copy or use this file in either
  10. ** source code or executable form, except in compliance with the terms and
  11. ** conditions of the SLA.
  12. **
  13. ** All software distributed under the SLA is provided strictly on an
  14. ** "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  15. ** AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
  16. ** LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  17. ** PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the SLA for specific
  18. ** language governing rights and limitations under the SLA.
  19. **
  20. ** Project: .NET based OPC UA Client Server SDK
  21. **
  22. ** Description: OPC Unified Architecture Software Development Kit.
  23. **
  24. ** The complete license agreement can be found here:
  25. ** http://unifiedautomation.com/License/SLA/2.7/
  26. ******************************************************************************/
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Linq;
  30. using System.Text;
  31. using UnifiedAutomation.UaBase;
  32. using UnifiedAutomation.UaServer;
  33. namespace acdp
  34. {
  35. class Program
  36. {
  37. static void Main(string[] args)
  38. {
  39. try
  40. {
  41. // The license file must be loaded from an embedded resource.
  42. ApplicationLicenseManager.AddProcessLicenses(System.Reflection.Assembly.GetExecutingAssembly(), "License.lic");
  43. // Start the server.
  44. Console.WriteLine("Starting Server.");
  45. AcdpServerManager server = new AcdpServerManager();
  46. ApplicationInstance.Default.Start(server, null, server);
  47. // print the endpoints.
  48. Console.WriteLine(string.Empty);
  49. Console.WriteLine("Listening at the following endpoints:");
  50. foreach (EndpointDescription endpoint in ApplicationInstance.Default.Endpoints)
  51. {
  52. StatusCode error = server.Application.GetEndpointStatus(endpoint);
  53. Console.WriteLine(" {0}: Status={1}", endpoint, error.ToString(true));
  54. }
  55. Console.WriteLine(string.Empty);
  56. // Block until the server exits.
  57. Console.WriteLine("Press <enter> to exit the program.");
  58. Console.ReadLine();
  59. // Stop the server.
  60. Console.WriteLine("Stopping Server.");
  61. server.Stop();
  62. }
  63. catch (Exception e)
  64. {
  65. Console.WriteLine("ERROR: {0}", e.Message);
  66. Console.WriteLine("Press <enter> to exit the program.");
  67. Console.ReadLine();
  68. }
  69. }
  70. }
  71. }