mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-25 07:41:32 +08:00
Disable Nagle on sockets, send packets in one shot.
This commit is contained in:
@@ -60,6 +60,7 @@ namespace MQTTnet.Implementations
|
||||
if (_socket == null)
|
||||
{
|
||||
_socket = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
}
|
||||
|
||||
#if NET452 || NET461
|
||||
@@ -68,6 +69,8 @@ namespace MQTTnet.Implementations
|
||||
await _socket.ConnectAsync(_options.Server, _options.GetPort()).ConfigureAwait(false);
|
||||
#endif
|
||||
|
||||
_socket.NoDelay = true;
|
||||
|
||||
if (_options.TlsOptions.UseTls)
|
||||
{
|
||||
_sslStream = new SslStream(new NetworkStream(_socket, true), false, InternalUserCertificateValidationCallback);
|
||||
|
||||
Reference in New Issue
Block a user