Reputation: 1
i am trying to use jabber.net for web application i know this is for desktop application as given in below given link
http://www.codeproject.com/Articles/34300/Google-Chat-Desktop-Application-using-Jabber-Net
but i found a post on stack overflow related to this and it say that one dude has implemented it with web application
Web Chat Application - ASP.NET/Jabber/Ajax/WCF/Comet/ReverseAjax - Issues Faced - Seeking Insights
actually the code project code was written in c#
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using jabber.client;
using System.Threading;
using jabber.protocol.iq;
using jabber;
using Google.GData.Contacts;
using Google.GData.Extensions;
using jabber.protocol;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
static ManualResetEvent done = new ManualResetEvent(false);
private jabber.client.JabberClient jabberClient1=new jabber.client.JabberClient();
protected void Page_Load(object sender, EventArgs e)
{
jabberClient1.OnMessage += new MessageHandler(jabberClient1_OnMessage);
jabberClient1.OnDisconnect += new bedrock.ObjectHandler(jabberClient1_OnDisconnect);
jabberClient1.OnError += new bedrock.ExceptionHandler(jabberClient1_OnError);
jabberClient1.OnAuthError += new jabber.protocol.ProtocolHandler(jabberClient1_OnAuthError);
jabberClient1.User = "sa";
jabberClient1.Server = "gmail.com";
jabberClient1.Password = "download";
jabberClient1.Connect();
jabberClient1.OnAuthenticate += new bedrock.ObjectHandler(jabberClient1_OnAuthenticate);
}
void jabberClient1_OnAuthenticate(object sender)
{
done.Set();
}
void jabberClient1_OnAuthError(object sender, System.Xml.XmlElement rp)
{
if (rp.Name == "failure")
{
Response.Write("Invalid User Name or Password");
}
}
void jabberClient1_OnError(object sender, Exception ex)
{
Response.Write(ex.Message);
}
void jabberClient1_OnDisconnect(object sender)
{
Response.Write("Disconnected");
}
private void jabberClient1_OnMessage(object sender, jabber.protocol.client.Message msg)
{
Response.Write("Message Posted");
//frmChat[(int)chatIndex[msg.From.Bare]].ReceiveFlag = true;
//string receivedMsg = msg.From.User + " Says : " + msg.Body + "\n";
//frmChat[(int)chatIndex[msg.From.Bare]].AppendConversation(receivedMsg);
//frmChat[(int)chatIndex[msg.From.Bare]].Show();
}
}
}
so i converted it to vb.net like this
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports jabber.client
Imports System.Threading
Imports jabber.protocol.iq
Imports jabber
Imports Google.GData.Contacts
Imports Google.GData.Extensions
Imports jabber.protocol
Public Class GtalkIntegration
Inherits System.Web.UI.Page
Shared done As New ManualResetEvent(False)
Private WithEvents jabberClient1 As New jabber.client.JabberClient()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddHandler jabberClient1.OnMessage, AddressOf jabberClient1_OnMessage
AddHandler jabberClient1.OnDisconnect, AddressOf jabberClient1_OnDisconnect
AddHandler jabberClient1.OnError, AddressOf jabberClient1_OnError
AddHandler jabberClient1.OnAuthError, AddressOf jabberClient1_OnAuthError
jabberClient1.User = "sa"
jabberClient1.Server = "gmail.com"
jabberClient1.Password = "download"
jabberClient1.Connect()
AddHandler jabberClient1.OnAuthenticate, AddressOf jabberClient1_OnAuthenticate
End Sub
Private Sub jabberClient1_OnAuthenticate(ByVal sender As Object)
done.[Set]()
End Sub
Private Sub jabberClient1_OnAuthError(ByVal sender As Object, ByVal rp As System.Xml.XmlElement)
If rp.Name = "failure" Then
Response.Write("Invalid User Name or Password")
End If
End Sub
Private Sub jabberClient1_OnError(ByVal sender As Object, ByVal ex As Exception)
Response.Write(ex.Message)
End Sub
Private Sub jabberClient1_OnDisconnect(ByVal sender As Object)
Response.Write("Disconnected")
End Sub
Private Sub jabberClient1_OnMessage(ByVal sender As Object, ByVal msg As jabber.protocol.client.Message)
Response.Write("Message Posted")
'frmChat[(int)chatIndex[msg.From.Bare]].ReceiveFlag = true;
'string receivedMsg = msg.From.User + " Says : " + msg.Body + "\n";
'frmChat[(int)chatIndex[msg.From.Bare]].AppendConversation(receivedMsg);
'frmChat[(int)chatIndex[msg.From.Bare]].Show();
End Sub
End Class
but it is giving me error like
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
please help me out guys thanks in advance
Upvotes: 0
Views: 1050
Reputation: 315
Make sure to reference jabber-net.dll, zlib.net.dll, and netlib.Dns.dll.
Upvotes: 2