Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
ansvenkataramana #1
Member since Aug 2012 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Across thread calls .. Unable to receive events
Hi,

I am writing a class library that uses Matrix Xmpp SDK to connect to an Xmpp server.  I am having a strange problem.  When the client library method that interacts with XMPP SDK is called from a different thread than the one that created its instance, I am not able to receive any events from Matrix XMPP SDK.  If the same thread is used, then events are received and everything works fine.

A very strange thing to note is that even this cross thread call works perfectly well when called from UT of my class library.

Can someone please help me?

Regards,
Venkataramana
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
try to set AutoInvoke to false and you should receive your events.

Alex
Avatar
ansvenkataramana #3
Member since Aug 2012 · 2 posts
Group memberships: Members
Show profile · Link to this post
I set AutoInvoke to false as suggested and it works fine now.  Thanks a million for the quick help.  I am still wondering why things worked when executed from UT (NUnit test harness) though.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MatriX is trying to find the Dispatcher of your app, and then is using this dispatcher to invoke all events. This is very useful for GUI apps and saves the programmer lots of code for invoking.
When working with non GUI apps and own threads this automatic invoking can fail.This is why you can disable 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: