サーバーに接続しようとしたときに 1 つの問題が発生しました。ライブラリagsXMPPと次のコードを使用しています。サーバーに接続しようとしても接続できません。サーバーでログを記録できません。一部のユーザーにもメッセージを送信しようとしました。
agsXMPP.XmppClientConnection xmpp = new XmppClientConnection();
string server = "ipServer";
string user = "user";
string pass = "password";
int port = 5222;
bool _wait = true;
xmpp.Status = "available";
xmpp.Show = ShowType.chat;
xmpp.Priority = 1;
xmpp.SendMyPresence();
xmpp.Server = server;
xmpp.Port = port;
xmpp.Username = usuCon;
xmpp.Password = usuCon;
xmpp.Open();
agsXMPP.Jid JID = new Jid("example@org.es);
agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
msg.Type = agsXMPP.protocol.client.MessageType.chat;
msg.To = JID;
msg.Body = "hi how are you? message" + DateTime.Now.ToString();
xmpp.OnLogin += delegate(object o) { xmpp.Send(msg); };
agsXMPP.protocol.server.Presence presencia2 = new agsXMPP.protocol.server.Presence();
presencia2.Type = new PresenceType();
xmpp.OnLogin += xmpp_OnLogin;
Console.WriteLine("Wait");
int i = 0;
do
{
Console.Write(".");
i++;
if (i == 10)
_wait = false;
Thread.Sleep(1000);
} while (_wait);
Console.WriteLine("\n" + msg);
Console.Read();
}
private void xmpp_OnLogin(object sender)
{
Console.WriteLine("yes");
}