How does the timeout apply on StreamSocket.readAsync()?

China☆狼群 提交于 2020-01-07 00:52:07

问题


I have created the streamSocket that received the stream of media. I want to read the stream on this socket and also want to apply readTimeout. So that I have applied it using CancellationTokenSource. As per my requirement, if I cant read within timeout limit, I dont want to close this socket. However, applying cancellation token causes the socket close in my program.

Is there any way to apply time out without closing the socket?

await socket.InputStream.ReadAsync(readBuffer, 8,     InputStreamOptions.None).AsTask(cts.Token);

来源:https://stackoverflow.com/questions/39077497/how-does-the-timeout-apply-on-streamsocket-readasync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!