You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MqttServerOptionsExtensions.cs 841 B

пре 7 година
12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace MQTTnet.Core.Server
  3. {
  4. public static class MqttServerOptionsExtensions
  5. {
  6. public static int GetSslEndpointPort(this MqttServerOptions options)
  7. {
  8. if (options == null) throw new ArgumentNullException(nameof(options));
  9. if (!options.SslEndpointOptions.Port.HasValue)
  10. {
  11. return 8883;
  12. }
  13. return options.SslEndpointOptions.Port.Value;
  14. }
  15. public static int GetDefaultEndpointPort(this MqttServerOptions options)
  16. {
  17. if (options == null) throw new ArgumentNullException(nameof(options));
  18. if (!options.DefaultEndpointOptions.Port.HasValue)
  19. {
  20. return 1883;
  21. }
  22. return options.DefaultEndpointOptions.Port.Value;
  23. }
  24. }
  25. }