[JDEV] Problems using JabberCOM in C#

lars at eid.as lars at eid.as
Sat Apr 20 14:34:16 CDT 2002


Hi all!

I'm having problems using JabberCOM (http://jabbercom.sourceforge.net)
with C# and after a little search on the internet, did I find that
I wasn't the only one having such problems. For some reason is an
error produced when trying to add a second event. This may be a bug
related to using JabberCOM in .NET, meaning that a workaround might be
hard to find. But hopefully has someone been able to find a solution..

I ran JabberCOM.dll through the tlbimp.exe tool and added it as a
reference in c#.
The source code I used is as follows:
- - -
using JabberCOM;

JabberSession js = new JabberSession();

js.OnConnect += new IJabberSessionEvents_OnConnectEventHandler(js_OnConnect);
js.OnAuthError += new IJabberSessionEvents_OnAuthErrorEventHandler
(js_OnAuthError);

js.Server = "jabber.com";
js.Username = "user";
js.Password = "pass";
js.Resource = "work";
js.Priority = 0;
js.DoConnect (false, 0);

protected void js_OnConnect()
{
	richTextBox1.Text = "Connected!";
}

protected void js_OnAuthError(string e)
{
	richTextBox1.Text = "Auth Error! : " + e;
}
- - -

Everything works fine with only one event, I start the application and
shortly after does the text change to "Connected!" in my richTextBox.
But when I add the second event, js.OnAuthError, this error is
produced:
Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80040202): Exception from HRESULT: 0x80040202.


So have anyone found a solution to the second event problem?
Or have any idea on how to solve this issue?

It would be really nice to be able to use the JabberCOM object,
but I have found some alternative solutions if that doesn't work out:

This example doesn't use any object to handle the communication with the Jabber
server, but use just c# to connect to the server. Would mean a lot of
extra work to do everything from scratch, so I'll rather avoid that.
http://www.dotnetremoting.cc/projects

So this looks much more promissing, and would maybe be the best choice for
c# developers anyway. 
http://nureality.myip.org/downloads.php
(WrapJabberNET is a wrapper class of Joe Hildebrand's Jabber.NET library 
http://sourceforge.net/projects/jabber-net, which is a Jabber library for 
the .NET framework. It allows an easy interface for client developers.)


Regards,
Lars



More information about the JDev mailing list