Reputation:
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 ?
Upvotes: 0
Views: 3184
Reputation:
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): [email protected]
, 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)
Upvotes: 4
Reputation: 13644
use this.
client = xmpp.Client('127.0.0.1',debug=[])
client.connect(server=('127.0.0.1',5222))
or your IP 192.X.X.X
Upvotes: 0