Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
WMFGREEN #1
Member since Jan 2012 · 20 posts
Group memberships: Members
Show profile · Link to this post
Subject: Error Handling Event
I would like to know what event is raised when a connection error occurs. (for example if uri or port is wrong)
Please help me if you can.
Thank you.

PS: I am using BOSH as transport type.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In this case you should get the OnError event during the login process because a session cannot be established.

  • When the login fails because of invalid credentials you get the OnAuthError event.
  • When the authentication succeeds and the session can be established but the network goes down during the session you get the OnClose and OnError event.
Avatar
WMFGREEN #3
Member since Jan 2012 · 20 posts
Group memberships: Members
Show profile · Link to this post
I tried the OnError and it didn't work.
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Just verified it, I get the OnError event when I use a wrong uri.
Are you using the latest binary? If yes then please write a small test case and instructions how to reproduce it.
Avatar
WMFGREEN #5
Member since Jan 2012 · 20 posts
Group memberships: Members
Show profile · Link to this post
private void InitHandlersForSession()
        {           
            _session.OnError +=new EventHandler<Matrix.ExceptionEventArgs>(_session_OnError);
            _session.OnAuthError += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(_session_OnAuthError);
            _session.OnMessage += new EventHandler<MessageEventArgs>(xmppClient_OnMessage);
            _session.OnClose += new EventHandler<Matrix.EventArgs>(_session_OnClose);           
        }

void _session_OnError(object sender, Matrix.ExceptionEventArgs e)
        {
            //TODO: see if exception is caught here in case of "bad" server info
        }

When I use a bad uri and put a breakpoint to the "void _session_OnError(object sender, Matrix.ExceptionEventArgs e)" method it doesn't break there. I used a System.Threading.Thread.Sleep(..) before opening the Xmpp connection also.
And I have the latest version of Matrix.dll.
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
When I use the MiniCient and put these 2 lines before the Open() method:

  1. xmppClient.Transport = Matrix.Net.Transport.BOSH;
  2. xmppClient.Uri = new System.Uri("http://matrix.ag-software22.de/http-bind/");

I get the OnError event.
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have just uploaded a new version which also handles HTTP error codes in the first session request and fires an OnError.
Please try again the latest version.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS