Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
TigerTuba1995 #1
Member since Aug 2014 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: I know I'm doing something wrong
We're testing the agsXMPP tools (downloaded from NuGet) and I wrote a simple program:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using agsXMPP;
  6. using agsXMPP.protocol.client;
  7.  
  8.  
  9. namespace ConsoleApplication1
  10. {
  11.     class Program
  12.     {
  13.        
  14.        
  15.         static void Main(string[] args)
  16.         {
  17.             XmppClientConnection xmpp = new XmppClientConnection("sv001");
  18.             xmpp.Open(@"bwhite@sv001", "xxxxxxxxxx");
  19.            
  20.             xmpp.Send(new Message("bwhite@sv001","bwhite@sv001",MessageType.chat,"Test"));
  21.         }
  22.     }
  23. }


(the password has been x'ed out in the code sample for obvious reasons).

It does nothing.  The SV001 is the name of our OpenFire server, but when I send a message to the user in question there is no message popping up.  This is VS 2012 as a console app (going to make a class library out of it but I wanted to test it this way first).
This post was edited on 2014-08-14, 16:08 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
agsXMPP is event based, and the open and send methods are both async.

1) your program (main function) terminates directly after the send method. Because its async it will not execute.
2) Because Open is also async you try to send the message before the connection was established and you were authenticated to the server.

I suggest that you download the latest version from here:
http://www.ag-software.net/download-directory/

and also the full version from here which includes code examples:
http://www.ag-software.net/agsxmpp-sdk/download/

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: agsXMPP RSS