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 line
459 B

  1. using System;
  2. namespace MQTTnet.Client
  3. {
  4. public static class MqttClientTcpOptionsExtensions
  5. {
  6. public static int GetPort(this MqttClientTcpOptions 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. }