diff --git a/Frameworks/MQTTnet.NetFramework/Implementations/MqttTcpChannel.cs b/Frameworks/MQTTnet.NetFramework/Implementations/MqttTcpChannel.cs index 9c3679a..677f759 100644 --- a/Frameworks/MQTTnet.NetFramework/Implementations/MqttTcpChannel.cs +++ b/Frameworks/MQTTnet.NetFramework/Implementations/MqttTcpChannel.cs @@ -93,8 +93,10 @@ namespace MQTTnet.Implementations private void CreateCommStreams( Socket socket, SslStream sslStream ) { - //cannot use this as default buffering prevents from receiving the first connect message _rawStream = (Stream)sslStream ?? new NetworkStream( socket ); + + //cannot use this as default buffering prevents from receiving the first connect message + //need two streams otherwise read and write have to be synchronized _sendStream = new BufferedStream( _rawStream, BufferConstants.Size ); _receiveStream = new BufferedStream( _rawStream, BufferConstants.Size ); } @@ -114,10 +116,5 @@ namespace MQTTnet.Implementations return certificates; } - - public int Peek() - { - return _socket.Available; - } } } \ No newline at end of file diff --git a/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.cs b/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.cs index 536ebf6..cca53a1 100644 --- a/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.cs +++ b/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpChannel.cs @@ -107,10 +107,5 @@ namespace MQTTnet.Implementations return certificates; } - - public int Peek() - { - return _socket.Available; - } } } \ No newline at end of file