Why can't I connect to Google Talk in agsXMPP?

I am trying to start using agsXMPP , but I am having some problems. I am trying to run this code:

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 starts and ends without any errors, but the "login" is never printed on the console. What am I doing wrong?

If that matters, I'm using Mono 2.4 on Ubuntu 10.04.

+3
source share
4 answers

If the connection.Open () locks are not blocked, then I doubt the problem is that your program ends up at the end of main, and therefore it runs and ends.

, , , ManualResetEvent:

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

, , .

+4

, . 5222 5223 .

+1

just add Console.ReadLine (); after the line 'connection.Open ();'

+1
source
// connection.Server = "gmail.com";
connection.ConnectServer = "talk3.l.google.com"; OR
connection.ConnectServer = "talk2.l.google.com";
connection.Username = "my username"; // I tried both with and without '@gmail.com'
connection.Password = "my password";
connection.Open();

talk3.l.google worked great for me.

0
source

Source: https://habr.com/ru/post/1753961/


All Articles