python does not connect to local XMPP server
Question: 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 ?


Answer: 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](https://tools.ietf.org/html/rfc6120#section-3.2).

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)
    

