25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MqttClientOptionsExtensions.cs 458 B

12345678910111213141516171819
  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. }