Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Yasu #1
Member since Sep 2011 · 22 posts
Group memberships: Members
Show profile · Link to this post
Subject: can't receive callbacks when using thread on Form Application
I'm evaluating MatriX trial version (ver 1.4.4).
I had trouble when the worker thread(not UI thread) on Windows Form Application calls MatriX API.

I create worker thread from UI thread, and call connect method from the worker thread ,
then Matrix callback only "OnValidateCertificate" and "OnBeforeSasl"( not callback even OnSendXml ).

The cases,  not using thread(call connect method directly from UI thread), and not using Forms ( call from TestCase )
are successful.

Matrix trial version has any restrictions for UI application?


I attached sample project file to reproduce this problem.
If you run, please change the line(64-67) of Program.cs.

Thanks.
The author has attached one file to this post:
WindowsFormsApplication1.zip 347.7 kBytes
You have no permission to open this file.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I can confirm that there is a problem.

In MatriX you can pass a Dispatcher objet which Matrix is using to invoke all events to make your UI thread safe. So you don't have to invoke all MatriX events because MatriX does this job already.

When you set no dispatcher manual then MatriX is using Dispatcher.CurrentDispatcher as the Dispatcher object. This fails with your threads.

Do you have an idea how you can pass a correct Dispatcher? For a test I disabled our dispatching in the code and it works fine with your threads. If we can find no other solution then I must add a property which disabled the automatic invokes in MatriX.

Alex
Avatar
Yasu #3
Member since Sep 2011 · 22 posts
Group memberships: Members
Show profile · Link to this post
Thank you for your suggestions.

I considered and tried but I could not find the solution..

Could you please add a property which disable dispatching ?
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I also find no other quick solution.
I will add a new property as soon as I have finished teh task I am currently working on. I come back to you in this thread.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have uploaded a new binary for the full .NET Framework to the latest builds. There is a new property AutoInvoke. When you set this to false before you call Open all your examples works fine for me.

Please let me know if this solves your problem.

Alex
Avatar
Yasu #6
Member since Sep 2011 · 22 posts
Group memberships: Members
Show profile · Link to this post
It worked well on my application, too!

Thanks a lot.
Avatar
fox168 #7
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex, Yasu,

Could you guys give an example of using AutoInvoke to make multithread client work?

Thanks!
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
download the latest version and add the following to your code:

  1. xmppClient.AutoInvoke = false;

Alex
Avatar
fox168 #9
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I've download the matriX again from http://www.ag-software.net/matrix-xmpp-sdk/download/. The new one is the same as the one I had, both of them are dated 11/4/2011 11:46 am and they do not have AutoInvoke defined (it seems that you implented it around 12/16/2011). Where to download the latest version?

Thanks!
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by fox168:
Where to download the latest version?

here: http://www.ag-software.net/download-directory/

Alex
Avatar
fox168 #11
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex! I've got it.
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: