Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Suvitruf #1
Member since Sep 2015 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Asynchronous client Open method
Are you planning to make client Open method assync? Open method takes ~233 ms, so it freezes main thread and gui.

I've tried to move it to separate thread:
  1. new Thread(() => {
  2.     m_XmppClient.Open();
  3. }).Start();

So, it takes ~60-80 ms. But anyways it's to much. AFAIK you are using raw socket. But why do you use synchronous Connect instead of async BeginConnect?
This post was edited on 2016-04-01, 11:01 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
All sockets in MatriX are asynchronous. So they use BeginConnect.

The only non async part can be depending on the platform you use the Srv DNS lookups. To avoid them you can set ResolveSrvRecords to false and set the hostname on your own.
If it still does not meet your requirements then call it in a background thread

Alex
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