SIPSorcery.Net.RTSPSession.ControlSocketReceive C# (CSharp) Méthode

ControlSocketReceive() private méthode

private ControlSocketReceive ( IAsyncResult ar ) : void
ar IAsyncResult
Résultat void
        private void ControlSocketReceive(IAsyncResult ar)
        {
            try
            {
                int bytesRead = _controlSocket.EndReceive(ar);

                if (_controlSocketError == SocketError.Success)
                {
                    _controlLastActivityAt = DateTime.Now;

                    System.Diagnostics.Debug.WriteLine(bytesRead + " bytes read from Control socket for RTSP session " + _sessionID + ".");

                    if (OnControlDataReceived != null)
                    {
                        OnControlDataReceived(_sessionID, _controlSocketBuffer.Take(bytesRead).ToArray());
                    }

                    _controlSocket.BeginReceive(_controlSocketBuffer, 0, _controlSocketBuffer.Length, SocketFlags.None, out _controlSocketError, ControlSocketReceive, null);
                }
                else
                {
                    if (!_closed)
                    {
                        logger.Warn("A " + _controlSocketError + " occurred receiving on Control socket for RTSP session " + _sessionID + ".");

                        if (OnControlSocketDisconnected != null)
                        {
                            OnControlSocketDisconnected(_sessionID);
                        }
                    }
                }
            }
            catch (Exception excp)
            {
                if (!_closed)
                {
                    logger.Error("Exception RTSPSession.ControlSocketReceive. " + excp);

                    if (OnControlSocketDisconnected != null)
                    {
                        OnControlSocketDisconnected(_sessionID);
                    }
                }
            }
        }