agsXMPP.XmppClientConnection.SocketOnError C# (CSharp) Method

SocketOnError() public method

public SocketOnError ( object sender, Exception ex ) : void
sender object
ex System.Exception
return void
        public override void SocketOnError(object sender, Exception ex)
        {
            base.SocketOnError(sender, ex);

            if ((ex.GetType() == typeof(ConnectTimeoutException) 
                || (ex.GetType() == typeof(SocketException) && ((SocketException)ex).ErrorCode == 10061))
                && _SRVRecords != null
                && _SRVRecords.Length > 1)
            {         
                // connect failed. We are using SRV records and have multiple results.
                // remove the current record
                RemoveSrvRecord(_currentSRVRecord);
                // find and set a new record
                SetConnectServerFromSRVRecords();
                // connect again
                OpenSocket();
            }
            else
            {

                // Fires the socket error
                if (OnSocketError != null)
                    OnSocketError(this, ex);

                // Only cleaneUp Session and raise on close if the stream already has started
                // if teh stream gets closed because of a socket error we have to raise both errors fo course
                if (m_StreamStarted && !m_CleanUpDone)
                    CleanupSession();                
            }            
        }