From 3d0ecc05ff876f6669a7e8eed54781624903e3b2 Mon Sep 17 00:00:00 2001 From: Christian Kratky Date: Wed, 4 Jul 2018 22:03:19 +0200 Subject: [PATCH] Fix bug which prevents receiving large packets for UWP. --- Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs b/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs index 2ccc7d9..8ae9192 100644 --- a/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs +++ b/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs @@ -154,7 +154,11 @@ namespace MQTTnet.Implementations private void CreateStreams() { - _readStream = _socket.InputStream.AsStreamForRead(_bufferSize); + // Attention! Do not set the buffer for the read method. This will + // limit the internal buffer and the read operation will hang forever + // is more data than the buffer size was received. + _readStream = _socket.InputStream.AsStreamForRead(); + _writeStream = _socket.OutputStream.AsStreamForWrite(_bufferSize); }