New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socket.Poll(μsTimeout, SelectMode.SelectRead) behavior is confusing #32719
Comments
Triage: We don't think we will change any APIs behavior even if it is confusing -- documenting the behavior seems like the best choice. |
Any initial progress on the documentation? Or at least a recommendation of another api call that can produce the desired behavior of determining if a:
In a bounded period of time? |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsOpened as suggested by @karelz when closing #26209 Microsoft Docs say that
As per my understanding, when the server is up and the connection ok, It would be great is someone could describe the intended behavior of
Is this behavior the same for every SocketType and ProtocolType combination, included the ones used to create the Socket returned by the TcpClient and UdpClient constructors? I am asking this because UDP is a connectionless protocol therefore a call to Poll could result in a different behavior since there is no connection to be "checked".
|
Opened as suggested by @karelz when closing #26209
Microsoft Docs say that
Socket.Poll
:or that the remote host was shut down ungracefully (you must attempt to send or receive data to detect these kinds of errors)
SelectMode.SelectRead
returns:true
if Listen(Int32) has been called and a connection is pendingtrue
if data is available for readingtrue
if the connection has been closed, reset, or terminatedfalse
otherwiseAs per my understanding, when the server is up and the connection ok,
Socket.Poll
withSelectMode.SelectRead
should returnfalse
immediately.Unfortunately this doesn't happen and a delay is experienced, due to the timeout expiring: this test fails on the last
Assert.Equal()
since the actual result is different from theExpected: 0
.It would be great is someone could describe the intended behavior of
Socket.Poll
withSelectMode.SelectRead
:true
only after the timeout elapses and returningfalse
immediatelyfalse
only after the timeout elapses and returningtrue
immediatelyIs this behavior the same for every SocketType and ProtocolType combination, included the ones used to create the Socket returned by the TcpClient and UdpClient constructors?
I am asking this because UDP is a connectionless protocol therefore a call to Poll could result in a different behavior since there is no connection to be "checked".
The text was updated successfully, but these errors were encountered: