您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MqttClientTcpOptionsExtensions.cs 464 B

12345678910111213141516171819
  1. using System;
  2. namespace MQTTnet.Core.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. }