Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
markz #1
Member since May 2009 · 11 posts
Group memberships: Members
Show profile · Link to this post
Subject: Socket Exceptions
Is Matrix Mobile handling socket errors? I received the following exception when the server that I was connected to was having problems. I can also get it to repeat by disconnecting my routers internet connection:

ErrorCode: 10054
Message: "An existing connection was forcibly closed by the remote host"
StackTrace:
   at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer)
   at Matrix.Net.ClientSocket. ()



I also receive the following exception when I take away the emulator's network connection or turn off the WiFi/Phone radio on my device:

ErrorCode: 10038
Message: "An operation was attempted on something that is not a socket"
StackTrace:
   at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer)
   at Matrix.Net.ClientSocket. ()



Thanks,
Mark
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes it should handle socket errors, but its possible that there is still a bug.
Does this happen with or without TLS, or on both?
I try to cause this error and debug it.

Alex
Avatar
Alex #3
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I was able cause one of the exceptions and fix it. A new dll is at http://www.ag-software.net/downloads.html
Let me know if this fixes your problem.

Alex
Avatar
markz #4
Member since May 2009 · 11 posts
Group memberships: Members
Show profile · Link to this post
Previously I only saw the exceptions when using StartTLS. I tried again without StartTLS and did not get the exceptions. With the new dll I do not get the exceptions with or without StartTLS, so it looks like it's fixed. Thanks again for the quick update.

On a related note, when I attempt to reconnect after a connection has been closed, either due to a socket error or a call to _xmppClient.Close(), it does not connect. This is not really a problem because I can get around it by creating a new XmppClient object (i.e., _xmppClient = new XMPPClient()) and then re-attaching my event handlers. But I was wondering if this is the expected behavior.

Thanks,
Mark
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by markz on 2010-01-20, 15:51:
1263999101

its shouldn't do that. I put this on my TODO list and will debug it ASAP.

Alex
Avatar
markz #6
Member since May 2009 · 11 posts
Group memberships: Members
Show profile · Link to this post
Some additional information that might help:

When using the MiniClient sample with StartTls: connect, disconnect, then connect again, and it crashes on the reconnection. This does not seem to happen when not using StartTLS.

In my application when I was trying to create a new connection object before each reconnect, it crashes sometimes but not always, using StartTLS or not does not seem to make a difference here.
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: