mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1847af13d2 | ||
|
|
8916df8d7b |
@@ -11,8 +11,7 @@
|
|||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<description>MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker) and supports v3.1.0, v3.1.1 and v5.0.0 of the MQTT protocol.</description>
|
<description>MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker) and supports v3.1.0, v3.1.1 and v5.0.0 of the MQTT protocol.</description>
|
||||||
<releaseNotes>
|
<releaseNotes>
|
||||||
* [Core] Fixed wrong versions in nuget packages.
|
* [Server] Moved new socket options to TCP options to avoid incompatibility with Linux hosts.
|
||||||
* [Server] The TCP address is now reused when starting which should prevent "port in used" error when restarting.
|
|
||||||
</releaseNotes>
|
</releaseNotes>
|
||||||
<copyright>Copyright Christian Kratky 2016-2019</copyright>
|
<copyright>Copyright Christian Kratky 2016-2019</copyright>
|
||||||
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
||||||
|
|||||||
@@ -60,8 +60,17 @@ namespace MQTTnet.Implementations
|
|||||||
_logger.Info($"Starting TCP listener for {_localEndPoint} TLS={_tlsCertificate != null}.");
|
_logger.Info($"Starting TCP listener for {_localEndPoint} TLS={_tlsCertificate != null}.");
|
||||||
|
|
||||||
_socket = new Socket(_addressFamily, SocketType.Stream, ProtocolType.Tcp);
|
_socket = new Socket(_addressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||||
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
|
||||||
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
|
if (_options.ReuseAddress)
|
||||||
|
{
|
||||||
|
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options.NoDelay)
|
||||||
|
{
|
||||||
|
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
|
||||||
|
}
|
||||||
|
|
||||||
_socket.Bind(_localEndPoint);
|
_socket.Bind(_localEndPoint);
|
||||||
_socket.Listen(_options.ConnectionBacklog);
|
_socket.Listen(_options.ConnectionBacklog);
|
||||||
|
|
||||||
|
|||||||
@@ -19,5 +19,10 @@ namespace MQTTnet.Server
|
|||||||
public IPAddress BoundInterNetworkAddress { get; set; } = IPAddress.Any;
|
public IPAddress BoundInterNetworkAddress { get; set; } = IPAddress.Any;
|
||||||
|
|
||||||
public IPAddress BoundInterNetworkV6Address { get; set; } = IPAddress.IPv6Any;
|
public IPAddress BoundInterNetworkV6Address { get; set; } = IPAddress.IPv6Any;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This requires admin permissions on Linux.
|
||||||
|
/// </summary>
|
||||||
|
public bool ReuseAddress { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user