2

我创建了一个程序来通过 localhost 的两个端口之间的套接字发送聊天消息。我需要第三个客户端,它使用 xmpp 协议连接到本地主机并将消息发送到这里。当我在终端中运行我的服务器时,它显示第三个客户端已连接

我的代码如下:

import xmpp
msg='how r u :)'

client = xmpp.Client('localhost')
print "clienttttttttttttttttttt",client
con=client.connect(server=('localhost',5000))
#client.auth(username, passwd, 'botty')
#client.sendInitPresence()
message = xmpp.Message('localhost', msg)
print "messageeeeeeeeeeeeeeeeeeee",message
message.setAttr('type', 'chat')
client.send(message)

当我执行此代码时,会发生此错误

Registering protocol "error" as <class 'xmpp.protocol.Protocol'>(http://etherx.jabber.org/streams)
DEBUG: socket       sent  <?xml version='1.0'?>
  <stream:stream xmlns="jabber:client" to="localhost" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" >

我正在使用 python xmpppy 库。这里有什么问题。我将如何将我的消息发送到使用套接字发送消息的本地主机。请帮助????

4

0 回答 0