i'm trying to connect my local XMPP server by the code coming below
import xmpp
client = xmpp.Client('localhost',debug=[])
client.connect(server=('localhost',5222))
but i always get this message :
An error occurred while looking up _xmpp-client._tcp.localhost
i've checked that the port 5222 is already opened(by using telnet). (i have to mention that the firewall on the localhost is off) now what should i add to this code to make it work ?
This message (a warning, not an error as pointed out in xinox's answer) is indicating that a DNS SRV record lookup failed. DNS SRV records are used to find services that are associated with a certain domain (eg. localhost
in this case, so not really a domain at all which is why the lookup is failing), but which delegate their responsibility to a server living somewhere else.
For instance, if I have a server at example.net
, making my Jabber ID (JID): user@example.net
, but my XMPP server lived at chat.example.net
I could construct an SRV record on example.net
to point to chat.example.net
. There are other ways to delegate responsibility, but this is the preferred one. XMPPs use of SRV records is defined in RFC 6120 §3.2.1 .
To actually get rid of this error you can use the use_srv
kwarg, making your initial example:
import xmpp
client = xmpp.Client('localhost',debug=[])
client.connect(server=('localhost',5222), use_srv=False)
use this.
client = xmpp.Client('127.0.0.1',debug=[])
client.connect(server=('127.0.0.1',5222))
or your IP 192.XXX
i figured this out , just remember that this is a warning not just an error . the python connected to openfire XMPP server correctly and it works fine .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.