mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
20 lines
459 B
C#
20 lines
459 B
C#
using System;
|
|
|
|
namespace MQTTnet.Client
|
|
{
|
|
public static class MqttClientTcpOptionsExtensions
|
|
{
|
|
public static int GetPort(this MqttClientTcpOptions options)
|
|
{
|
|
if (options == null) throw new ArgumentNullException(nameof(options));
|
|
|
|
if (options.Port.HasValue)
|
|
{
|
|
return options.Port.Value;
|
|
}
|
|
|
|
return !options.TlsOptions.UseTls ? 1883 : 8883;
|
|
}
|
|
}
|
|
}
|