Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
msims #1
Member since Jul 2005 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Mono and agsXMPP
Hi,

Not sure how many people are using these libraries with Mono (it does say Mono is supported).
It seems to login but unable to send messages or display presence.
The documentation isn't that great if anyone has got this working with mono could you please help.

Trying to run the example given on site :

XmppClientConnection xmpp = new XmppClientConnection("jabber.org");
xmpp.Open("myUsername", "mySecret");
xmpp.Send( new Message("test@jabber.org", MessageType.chat, "Hello, how are you?"));

Thanks
Matt

ps. All works under .NET on Windows
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi Matt,

this small sample shows only how easy it is to send a message. The first 2 lines are for opening the xmpp session to the server. You have to wait for the OnLogin event. After this event you are authenticated and can send the message with the code in line 3.
Yes it works under mono. I think a user already posted here a small client sample.
I have some test cases that i run before each new release under windows, pocket pc, smartphone and mono on linux (fc3 or debian)

Alex
Avatar
msims #3
Member since Jul 2005 · 4 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

Thanks for the quick response.
Here is the code I'm using which is the code supplied with the libraries, it works 100% with .NET on Windows but need to get it working under Mono. If you could confirm that it works under Mono that would be great, or if you could supply a test case that you know works Linux would be better.

thanks again

Matt

//----------- My Code Start -------------------
using System;
using agsXMPP;

class MainClass
{
    static XmppClientConnection xmpp;
   
    [STAThread]
    static void Main(string[] args)
    {
        // Enter your account data here for testing
    string server    = "jabber.org";
    string user        = "myUserNameforJabber";
    string pass        = "myPasswordforJabber";

    Console.WriteLine("Press Key!");
    Console.ReadLine();

    xmpp = new XmppClientConnection(server, 5222);
    xmpp.UseSSL = false;
       
    xmpp.OnReadXml    += new agsXMPP.XmppClientConnection.XmlHandler(xmpp_OnReadXml);
    xmpp.OnWriteXml    += new agsXMPP.XmppClientConnection.XmlHandler(xmpp_OnWriteXml);
    xmpp.OnLogin    += new ObjectHandler(xmpp_OnLogin);
    xmpp.OnError    += new agsXMPP.XmppClientConnection.ErrorHandler(xmpp_OnError);

    try
    {
        xmpp.Open(user, pass, "ConsoleClient", 5);
    }
    catch(Exception ex)
    {
        Console.WriteLine(ex.Message);
    }

    Console.WriteLine("Press Key!");
    Console.ReadLine();

    Console.WriteLine("Close XMPP Stream:");           
    //xmpp.Send(new agsXMPP.protocol.Message("some jid", agsXMPP.protocol.MessageType.chat,"Test"));

    Console.WriteLine("Press Key!");
    Console.ReadLine();
    xmpp.Close();
    }

    private static void xmpp_OnLogin(object sender)
    {
        Console.WriteLine("we are logged in to the server now");
        Console.WriteLine("set presence");
        xmpp.SendMyPresence();
    }

    private static void xmpp_OnError(object sender, Exception ex)
    {
        Console.WriteLine(ex.Message);
    }

    private static void xmpp_OnReadXml(object sender, string xml)
    {
        Console.WriteLine("RECV XML: " + xml );
    }

    private static void xmpp_OnWriteXml(object sender, string xml)
    {
        Console.WriteLine("SEND XML: " + xml );
    }
}
//----------- My Code End -------------------
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi msims,

found the problem. Look also here:
http://forum.ag-software.de/post/205
Could you please inform me if it works with the changes?

Alex
Avatar
msims #5
Member since Jul 2005 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Mono and agsXPMM
Hi Alex,

Made the changes you suggested and everything works perfectly.
Both .NET and Mono using the same libraries.

Thanks very much for your help.

Matt

For your interest :
Linux Dev Box using Suse 9.3, Mono 1.1.8 and MonoDevelop
Windows Dev Box using WinXP, .NET 1.1 SP1 and VS 2003
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Matt,

did you get MonoDevelop running with the debugger plugin under Suse?
Because it was a hard fight to locate the problem without debugger on debian.

Alex
Avatar
msims #7
Member since Jul 2005 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Mono and agsXPMM
Alex,

Sorry I don't have debugging enabled at this time, as I still use VS 2003 as my main development tool. Will be moving more permanently over to Mono in the next month, for the mean time I'll try and enable the debug option for MonoDevelop and tell you how it goes.

Suse 9.3 and Ubuntu have been the best and easiest installing Mono.

I'll keep in touch.

Thanks again for all your help.

Matt
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