浏览代码

Changed socket features.

release/3.x.x
Christian 6 年前
父节点
当前提交
b9a73cc23d
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. +1
    -0
      Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.Uwp.cs
  2. +5
    -2
      Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.Uwp.cs
  3. +1
    -1
      Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs

+ 1
- 0
Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.Uwp.cs 查看文件

@@ -49,6 +49,7 @@ namespace MQTTnet.Implementations
{
_socket = new StreamSocket();
_socket.Control.NoDelay = true;
_socket.Control.KeepAlive = true;
}

if (!_options.TlsOptions.UseTls)


+ 5
- 2
Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.Uwp.cs 查看文件

@@ -33,9 +33,12 @@ namespace MQTTnet.Implementations

// This also affects the client sockets.
_defaultEndpointSocket.Control.NoDelay = true;
_defaultEndpointSocket.Control.KeepAlive = true;
_defaultEndpointSocket.Control.QualityOfService = SocketQualityOfService.LowLatency;
_defaultEndpointSocket.ConnectionReceived += AcceptDefaultEndpointConnectionsAsync;

await _defaultEndpointSocket.BindServiceNameAsync(options.GetDefaultEndpointPort().ToString(), SocketProtectionLevel.PlainSocket);
_defaultEndpointSocket.ConnectionReceived += AcceptDefaultEndpointConnectionsAsync;
}

if (options.TlsEndpointOptions.IsEnabled)
@@ -59,7 +62,7 @@ namespace MQTTnet.Implementations

public void Dispose()
{
StopAsync();
StopAsync().GetAwaiter().GetResult();
}

private void AcceptDefaultEndpointConnectionsAsync(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)


+ 1
- 1
Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs 查看文件

@@ -88,7 +88,7 @@ namespace MQTTnet.Implementations

public void Dispose()
{
StopAsync();
StopAsync().GetAwaiter().GetResult();
}

private async Task AcceptDefaultEndpointConnectionsAsync(CancellationToken cancellationToken)


正在加载...
取消
保存