System.Net.Sockets.Socket.UpdateStatusAfterSocketError C# (CSharp) Method

UpdateStatusAfterSocketError() private method

private UpdateStatusAfterSocketError ( SocketError errorCode ) : void
errorCode SocketError
return void
        internal void UpdateStatusAfterSocketError(SocketError errorCode)
        {
            // If we already know the socket is disconnected
            // we don't need to do anything else.
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);
            if (NetEventSource.IsEnabled) NetEventSource.Error(this, $"errorCode:{errorCode}");

            if (_isConnected && (_handle.IsInvalid || (errorCode != SocketError.WouldBlock &&
                    errorCode != SocketError.IOPending && errorCode != SocketError.NoBufferSpaceAvailable &&
                    errorCode != SocketError.TimedOut)))
            {
                // The socket is no longer a valid socket.
                if (NetEventSource.IsEnabled) NetEventSource.Info(this, "Invalidating socket.");
                SetToDisconnected();
            }
        }

Same methods

Socket::UpdateStatusAfterSocketError ( SocketException socketException ) : void

Usage Example

示例#1
0
        internal void FinishOperationSyncFailure(SocketError socketError, int bytesTransferred, SocketFlags flags)
        {
            SetResults(socketError, bytesTransferred, flags);

            // This will be null if we're doing a static ConnectAsync to a DnsEndPoint with AddressFamily.Unspecified;
            // the attempt socket will be closed anyways, so not updating the state is OK.
            _currentSocket?.UpdateStatusAfterSocketError(socketError);

            Complete();
        }
All Usage Examples Of System.Net.Sockets.Socket::UpdateStatusAfterSocketError