Disable Nagle on sockets, send packets in one shot.

This commit is contained in:
Israel Lot
2018-04-16 12:30:56 -03:00
parent a5f33bc244
commit c915af8dad
6 changed files with 60 additions and 51 deletions
@@ -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);