- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 xmpppy python 库连接 XMPP 服务器(ejabberd2),但无法连接,并且实际上不清楚如何连接、验证并向服务器发送消息。
请帮助我使其正常工作
如果可能,请提供一些使用 XMPPPY 的代码片段。
最佳答案
我在 friend 的帮助下找到了解决方案
它需要更改 XMPP ejabberd 服务器配置。将行 {hosts, ["localhost"]} 更改为 {hosts, ["localhost", "server-domain", "server-ip-address"]}在 ejabberd.cfg 文件中。
重新启动服务器并使用服务器域或服务器IP在新主机下创建另一个用户。
代码片段:
import xmpp
ipaddress='<server-ip>'
user='<new-user>' #without @<server-ip>
passwd='<password>'
c = xmpp.Client(ipaddress)
c.connect((ipaddress,5222), secure=0)
c.auth(user,passwd,sasl=1)
c.sendInitPresence()
c.isConnected()
c.send(xmpp.protocol.Message('<jid of receiver user with @<domain> >',"hello world"))
关于python - XMPPPY无法连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34238000/
我正在使用 xmpppy。我创建了 50 多个 xmpp 连接线程。一段时间后我得到一个错误: File "transports.py", line 199, in pending_data retu
使用 XMPPPY 连接到 XMPP 服务器很简单。 from xmpp.client import Client as XMPPClient self.xmppClient = XMPPClient
如何使用此方法通过 xmpppy 发送数据:http://xmpp.org/extensions/xep-0047.html#send 我想我应该使用 IBB 类,但不知道该怎么做。 http://x
我正在尝试创建一个非常简单的脚本,它使用 python 的 xmpppy 通过 facebook 聊天发送消息。 import xmppFACEBOOK_ID = "username@chat.fac
我快要为这个问题抓狂了。我正在使用我能想到的最简单的代码来测试 xmppy,但它一次又一次地失败。我过去使用过 sendxmpp,但我正在尝试将一些服务器端脚本迁移到使用 python,而不是通过管道
我需要在连接到 gmail 时禁用 SSL 连接,我曾尝试过此代码: import xmpp username = 'username' passwd = 'password' to='friend@
我正在尝试使用 xmpppy 通过 Jabber(到 Google Talk)发送 XHTML(一个超链接),但找不到一个好的工作示例...我试过这个: http://intertwingly.net
我使用的代码: import xmppy jid = xmpp.JID('user@gmail.com') cl = xmpp.Client(jid.getDomain()) cl.connect(s
我在相关问题中找到了一个通过 xmpp(py) 发送消息的最小示例;见下文。但是当我执行脚本时,出现以下错误: client = xmpp.Client('gmail.com') Attribu
我正在尝试使用 xmpppy 访问我的 google talk 联系人的自定义状态消息。我做到了这一点: import xmpp import sys userID = 'myname@gmail
我是一名优秀的程序员,十分优秀!