Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
mpiroc #1
Member since Jul 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Why can't I connect to Google Talk?
I'm trying to get started using agsXMPP, but I'm having some problems. I'm trying to run this code (I'm following your example here):

using System;
using agsXMPP;

namespace TestAgs
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            XmppClientConnection connection = new XmppClientConnection ();
            connection.OnLogin += delegate {
                Console.WriteLine ("logged in");
            };
            connection.Server = "gmail.com";
            connection.ConnectServer = "talk.google.com";
            connection.Username = "my username"; // I tried both with and without '@gmail.com'
            connection.Password = "my password";
            connection.Open();
        }
    }
}

This compiles fine, but when I try to run it, nothing happens. It runs and completes without any errors, but "logged in" never gets printed to the console. What am I doing wrong?

If it makes a difference, I'm using Mono 2.4 on Ubuntu 10.04.
Avatar
mpiroc #2
Member since Jul 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
I forgot to mention, running the "GTalk" sample provided with agsXMPP doesn't work either. It just adds "OnError" to the list when I try to connect.
Avatar
Alex #3
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The Open method is asynchronous. This means your example terminates after the Open call.
Please post your Xml logs for the the GTalk example. I have not tried the lib on mono for a while, ubut as you said it should make no difference. There are some defined for Mono SSL, did you set them?

Alex
Avatar
mpiroc #4
Member since Jul 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex,

I updated my test program to keep it from terminating (I also tried specifying a port number, and making sure any error messages print), but I still see nothing printed to the console (it just hangs indefinitely). Here is my updated test program:

using System;
using agsXMPP;

namespace TestAgs
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            XmppClientConnection connection = new XmppClientConnection ();
            connection.OnLogin += delegate {
                Console.WriteLine ("logged in");
            };
            connection.OnError += delegate {
                Console.WriteLine ("error");
            };
            connection.Port = 5222;
            connection.Server = "gmail.com";
            connection.ConnectServer = "talk.google.com";
            connection.Username = "my username"; // I tried both with and without '@gmail.com'
            connection.Password = "my password";
            connection.Open();

            var resetEvent = new System.Threading.ManualResetEvent (false);
            resetEvent.WaitOne ();
        }
    }
}

About the GTalk example, I editted it to print errors, and this is what I get:

System.DllNotFoundException: Iphlpapi.dll
  at (wrapper managed-to-native) agsXMPP.net.dns.Iphlpapi:GetNetworkParams (byte[],int&)
  at agsXMPP.net.dns.IPConfigurationInformation.GetHostInfo () [0x00000]
  at agsXMPP.net.dns.IPConfigurationInformation.get_DnsServers () [0x00000]
  at agsXMPP.XmppClientConnection.ResolveSrv () [0x00000]

There are some defined for Mono SSL, did you set them?

I'm not quite sure what this means. There are some what defined for Mono? How do I find out what they are and set up?

Thanks for your time!
Avatar
mpiroc #5
Member since Jul 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
Never mind, I got it working. When I made your changes, I forgot to change the username and password back from "my username" and "my password" to my actual username and password. D'oh!

I'm happy to help you debug if you want to get GTalk working, but that's not something I need, so feel free to drop this issue. Thanks for your help!
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #4
Quote by mpiroc on 2010-07-10, 18:43:
System.DllNotFoundException: Iphlpapi.dll
  at (wrapper managed-to-native) agsXMPP.net.dns.Iphlpapi:GetNetworkParams (byte[],int&)
  at agsXMPP.net.dns.IPConfigurationInformation.GetHostInfo () [0x00000]
  at agsXMPP.net.dns.IPConfigurationInformation.get_DnsServers () [0x00000]
  at agsXMPP.XmppClientConnection.ResolveSrv () [0x00000]


you have set the Win32 compiler condition. This is why you get the exception.
The Iphlpapi API is on windows to get the DNS servers. The DNS server are used then for SRV lookups.

To connect to GTalk on Linux set ConnectServer to talk.google.com. Or add an patch for linux to read the DNS servers from the network configration. Then agsXMPP can looup the SRV records automatically.

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