C# Jabber-net 集成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1150700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 09:26:29  来源:igfitidea点击:

Jabber-net integration

c#xmppinstant-messaging

提问by

I'd like to ask your help regarding having a Google Talk Bot that will communicate with my code on my server.

我想请教您关于拥有一个 Google Talk Bot 的帮助,该机器人将与我的服务器上的代码进行通信。

I have downloaded Jabber-Net from code.google.com, but the examples there are not enough... I am new to these technologies, and have no clue about:

我已经从 code.google.com 下载了 Jabber-Net,但是那里的例子还不够......我对这些技术不熟悉,并且不知道:

  1. How will client arrive to my server? where should I change [if any] DNS to my server?
  2. Which server side library should I use?
  3. From the examples I understood that I need to have a Desktop-app running in the background constantly, which doesn't make sense to me.
  1. 客户端将如何到达我的服务器?我应该在哪里更改 [如果有] DNS 到我的服务器?
  2. 我应该使用哪个服务器端库?
  3. 从示例中我了解到我需要在后台不断运行桌面应用程序,这对我来说没有意义。

Does anyone has an example of some better references to understand this better? [Sorry for my ignorance...]

有没有人有一些更好的参考例子来更好地理解这一点?【原谅我的无知……】

采纳答案by Marcin Deptu?a

  1. I'm not sure if I understand what you ask correctly. If you're asking how to connect to chosen server, console sample shows how to do it simply, you basically fill out JID class. Sample from Jabber-Net
  1. 我不确定我是否理解您的要求。如果您询问如何连接到选定的服务器,控制台示例显示了如何简单地进行连接,您基本上填写了 JID 类。来自 Jabber-Net 的示例
JabberClient jc = new JabberClient();
JID j = new JID(jid);
jc.User = j.User;
jc.Server = j.Server;
jc.NetworkHost = networkHost;
jc.Port = port;
jc.Resource = "Jabber.Net Console Client";
jc.Password = pass;
jc.AutoStartTLS = TLS;
jc.AutoPresence = initialPresence;
  1. If you want to create your own server, there's a library (also running under .NET) called agsxmpp, it allows to create both, server and client, it's open source on MIT/GPL license afair. I don't know if jabber-net enables this feature. On the other hand, there are plenty of free jabber-server if you don't want to just use one of "public" ones, so it may be worth to consider just using something that is ready to be launched.

  2. There's a console sample in the project, you don't need desktop-app (if this is what you were asking?), so you can write service, console app or anything else.

  1. 如果你想创建你自己的服务器,有一个名为 agsxmpp 的库(也在 .NET 下运行),它允许创建服务器和客户端,它是 MIT/GPL 许可证上的开源。不知道 jabber-net 有没有启用这个功能。另一方面,如果您不想只使用“公共”服务器中的一个,那么有很多免费的 jabber-server,因此可能值得考虑只使用准备好启动的东西。

  2. 项目中有一个控制台示例,您不需要桌面应用程序(如果这是您要问的?),因此您可以编写服务、控制台应用程序或其他任何内容。

回答by John Sheehan

Here's a recent postthat shows an example of replying to incoming messages on Gtalk using .NET

这是最近的一篇文章,展示了使用 .NET 在 Gtalk 上回复传入消息的示例