Applies to: .NET Core
Symptoms
A time-out occurs when you run an application that's using the System.Net.Security.SslStream class and that calls the System.Net.Socket.Poll method to check data on the underlying socket. When this issue occurs, the Poll method returns a value of false.
Cause
The SslStream class is reading data from the socket faster than the application can read data from the stream buffer.
Solution
To work around this issue, use one of the following methods:
- Don't use the
Pollmethod in the application. Instead, use the Asynchronous Programming Model (APM) pattern to get callbacks when data arrives. - If you must use the
Pollmethod, when the method returns a value oftrue, make sure that all the stream buffer data was read before you enter anotherPollcall.
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors (upstream author metadata: aartig13). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
