Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Jro #1
Member since Feb 2010 · 27 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Close / Reconnnect Problems with StartTLS = True
Using Matrix DLL 1.2.1.1, WinMo 6, Professional Emulator

I get a variation of problems resembling either an emulator hang, a debugger disconnect, or an emulator crash frequently when I call xmppClient.Open following a previously called xmppClient.Close.  It is not consistent, but it is repeatable after a few tries (usually 2-10).  The easiest repeatable test I've produced was simply calling xmppClient.Open inside the OnClose event in the provided mobile sample client.  Thus I use sample client's GUI to disconnect myself, which causes the client to reconnect via the xmppClient.Open call in OnClose.  Repeating this sequence a few times will reproduce one of the above variations (crash, hang, etc).

This problematic behavior occurs specifically with StartTLS = true, I have no issues doing the above test case with StartTls disabled.  I've seen this same behavior on my prototype app, on hardware as well as emulator (StartTLS = true leads to issues on frequent reconnects; these reconnects usually have at least 10 seconds in between their corresponding Close and Open calls; StartTLS = false leads to no issues).

I've piped the XML to Studio's debug output and this is consistently the last messages prior to an emulator/debugger/various crash:

i -> 3
OnClose Event Fired, calling xmppClient.Open()
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="folka" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="folka" id="aadf23d0" lang="en" version="1.0" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>ANONYMOUS</mechanism>
  </mechanisms>
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <auth xmlns="http://jabber.org/features/iq-auth" />
  <register xmlns="http://jabber.org/features/iq-register" />
</stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
The program '[0xB6AF91D2] MiniClientWM.exe: Managed' has exited with code 0 (0x0).

As a final note, I've also implemented this same test situation in the desktop client and encountered no problems there.  Seems to be specifically an issue with the TLS component on the mobile version.
This post was edited on 2010-04-21, 21:46 by Jro.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Jro,

this problem was also discussed in the following thread:
http://forum.ag-software.de/thread/875

Because there are still no managed SSL sockets and SslStream in the Compact Framework I use API to put the socket in TLS or SSL mode. How to do this is described here:
http://blogs.msdn.com/cgarcia/archive/2009/08/21/enable-ss….

When the CF socket is in SSL mode it supports only synchronous read and write operations, so I added some additional stuff to get asynchronous behavior which is required from XMPP.

I am aware of the crashes, but I couldn't find any errors in my code. And the app is crashing without any verbose error messages. I will take a look again. If I can't find a problem I have either remove the SSL stuff or mark it as experimental until Microsoft adds real SSL support to the CF.

Alex
Avatar
Jro #3
Member since Feb 2010 · 27 posts
Group memberships: Members, Premium
Show profile · Link to this post
Understandable.  Pending any potential fixes, would this be an appropriate circumstance where one could use BOSH to achieve some degree of security?
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Jro:
...  one could use BOSH to achieve some degree of security?
yes, BOSH over HTTPS offers the same level of security.

Alex
Avatar
Jro #5
Member since Feb 2010 · 27 posts
Group memberships: Members, Premium
Show profile · Link to this post
Has there been any news on this?

I've begun to switch over to Bosh-HTTPS and have ran into some issues.

[e]I've moved the BOSH issues over to a BOSH thread I had started earlier in the year: http://forum.ag-software.de/thread/882
This post was edited on 2010-05-03, 20:31 by Jro.
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Jro:
Has there been any news on this?

no, I spend 2 days on debugging this without finding any errors.
Because of WP7 I don't think that Microsoft will release a CF4.0 with SslStream.
I have to exclude the TLS code, write a small example and get support from Microsoft. Currently I am very busy with other tasks, so this has a lower priority for me right now.

Alex
Avatar
Jro #7
Member since Feb 2010 · 27 posts
Group memberships: Members, Premium
Show profile · Link to this post
Understandable - Thanks for the help and guidance on this Alex.
This post was edited on 2010-05-04, 21:40 by Jro.
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