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.
 
 
 
 

20 lines
458 B

  1. using System;
  2. namespace MQTTnet.Core.Client
  3. {
  4. public static class MqttClientOptionsExtensions
  5. {
  6. public static int GetPort(this MqttClientOptions options)
  7. {
  8. if (options == null) throw new ArgumentNullException(nameof(options));
  9. if (options.Port.HasValue)
  10. {
  11. return options.Port.Value;
  12. }
  13. return !options.TlsOptions.UseTls ? 1883 : 8883;
  14. }
  15. }
  16. }