locked
Could not connect to xmpp.messenger.live.com:5222 ? RRS feed

  • Question

  • Hi!

    We have a problem connecting to Messenger service by address xmpp.messenger.live.com on port 5222. It seems that this host and port does not accept connections. We are using parameters described at http://msdn.microsoft.com/en-us/library/live/hh826554#sign_in

    Any solution for this case?

    Thanks

    Monday, June 11, 2012 1:28 PM

Answers

  • Hi Alper,

    You should be changing the Host value, not Service. Service should always be "messenger.live.com", as the domain JID that Messenger is using.

    Thanks,

    Bill

    Thursday, August 2, 2012 1:45 AM

All replies

  • I was able to connect to that host and port using a test client. Can you provide any more information? For example:

    • Do you get a TCP connection refused error, or some other socket-level error?
    • Does the connection get established, but you don't receive anything from the server?
    • Are you able to make a partial connection, but unable to finish it (for example, TLS negotiation fails)?
    • Or something else?

    Thanks,

    Bill

    Monday, June 11, 2012 7:27 PM
  • $ host -t srv messenger.live.com
    messenger.live.com is an alias for home.skyprod.akadns.net.
    $ telnet home.skyprod.akadns.net 5222
    Trying 157.55.96.251...
    telnet: connect to address 157.55.96.251: Operation timed out
    telnet: Unable to connect to remote host

    Java library that I'm using org.jivesoftware.smack

    Host/port settings - default:

        public static final String Host = "xmpp.messenger.live.com";
        public static final int Port = 5222;
        public static final String Service = "messenger.live.com";

    .......

        public void logIn() {

            // Create a connection. We use service name in config and asmack will do
            // SRV look up locate the xmpp server.
            ConnectionConfiguration connConfig = new ConnectionConfiguration(
                    XmppClient.Service);
    .....

    Exception:

    XMPPError connecting to messenger.live.com:5222.: remote-server-error(502) XMPPError connecting to messenger.live.com:5222.
      -- caused by: java.net.ConnectException: Operation timed out
        at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:524)
        at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:953)
        at com.toasternet.im.XmppClient.logIn(XmppClient.java:88)
        at com.toasternet.im.App.main(App.java:21)
    Nested Exception:
    java.net.ConnectException: Operation timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.Socket.connect(Socket.java:546)
        at java.net.Socket.connect(Socket.java:495)
        at org.jivesoftware.smack.proxy.DirectSocketFactory.createSocket(DirectSocketFactory.java:28)
        at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:512)
        at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:953)
        at com.toasternet.im.XmppClient.logIn(XmppClient.java:88)
        at com.toasternet.im.App.main(App.java:21)
    Exception in thread "main" java.lang.NullPointerException
        at com.toasternet.im.XmppClient.sendMessage(XmppClient.java:119)
        at com.toasternet.im.App.main(App.java:22)
    Java Result: 1

    Tuesday, June 12, 2012 11:37 AM
  • The test client that I'm using is based on Smack (because, like you, many customers are using it or a variation such as asmack).

    In the example above, it looks like you are connecting directly to "messenger.live.com" as a FQDN, on port 5222. This is incorrect. If you are using asmack on the Android platform, then this sounds like a possible bug, or an incomplete port of Smack's SRV lookup feature.

    The 64.4.9.244 address is correct for me. Please see below for details.

    From RFC 3920 (http://xmpp.org/rfcs/rfc3920.html), section 14.3 (Client to Server Communications):

    Client-to-server communications MUST NOT proceed until the DNS hostname asserted by the server has been resolved. Such resolutions SHOULD first attempt to resolve the hostname using an [SRV] Service of "xmpp-client" and Proto of "tcp", resulting in resource records such as "_xmpp-client._tcp.example.com." (the use of the string "xmpp-client" for the service identifier is consistent with the IANA registration). If the SRV lookup fails, the fallback is a normal IPv4/IPv6 address record resolution to determine the IP address, using the "xmpp-client" port 5222, registered with the IANA.

    $ dig srv _xmpp-client._tcp.messenger.live.com

    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57656
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 10

    ;; QUESTION SECTION:
    ;_xmpp-client._tcp.messenger.live.com. IN SRV

    ;; ANSWER SECTION:
    _xmpp-client._tcp.messenger.live.com. 3600 IN SRV 10 0 5222 xmpp.messenger.live.com.

    ;; AUTHORITY SECTION:
    live.com.               151258  IN      NS      ns2.msft.net.
    live.com.               151258  IN      NS      ns3.msft.net.
    live.com.               151258  IN      NS      ns4.msft.net.
    live.com.               151258  IN      NS      ns5.msft.net.
    live.com.               151258  IN      NS      ns1.msft.net.

    ;; ADDITIONAL SECTION:
    ns1.msft.net.           211     IN      A       65.55.37.62
    ns1.msft.net.           211     IN      AAAA    2a01:111:2005::1:1
    ns2.msft.net.           241     IN      A       64.4.59.173
    ns2.msft.net.           241     IN      AAAA    2a01:111:2006:6::1:1
    ns3.msft.net.           1422    IN      A       213.199.159.59
    ns3.msft.net.           1422    IN      AAAA    2a01:111:2020::1:1
    ns4.msft.net.           2155    IN      A       207.46.75.254
    ns4.msft.net.           110     IN      AAAA    2404:f800:2003::1:1
    ns5.msft.net.           241     IN      A       65.55.226.140
    ns5.msft.net.           241     IN      AAAA    2a01:111:200f:1::1:1

    ;; Query time: 8 msec
    ;; SERVER: 207.115.64.172#53(207.115.64.172)
    ;; WHEN: Tue Jun 12 11:46:59 2012
    ;; MSG SIZE  rcvd: 415

    $ dig xmpp.messenger.live.com

    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48406
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 10, ADDITIONAL: 8

    ;; QUESTION SECTION:
    ;xmpp.messenger.live.com.       IN      A

    ;; ANSWER SECTION:
    xmpp.messenger.live.com. 3600   IN      CNAME   xmpp.messenger.geo.msnmessenger.msn.com.akadns.net.
    xmpp.messenger.geo.msnmessenger.msn.com.akadns.net. 300 IN CNAME bay.xmpp.msnmessenger.msn.com.akadns.net.
    bay.xmpp.msnmessenger.msn.com.akadns.net. 60 IN A 64.4.9.244

    Tuesday, June 12, 2012 6:52 PM
  • Hello,

    We are also couldn't connect to MSN xmpp service via Smack since 13th June. 

    MsnHost=xmpp.messenger.live.com

    MsnPort=5222

    Until that day we are able to connect MSN's XMPP services, successfully. 

    But now, when we send access token (that we got MSN) for XMPP MSN user, MSN doesn't send any response to us. 

    traceroute xmpp.messenger.live.com

    traceroute to xmpp.messenger.live.com (65.54.52.254), 30 hops max, 60 byte packets
     1  195.175.239.1.static.turktelekom.com.tr (195.175.239.1)  0.390 ms  0.478 ms  0.547 ms
     2  * * *
     3  uls-2-2-mmk-3-1.turktelekom.com.tr (81.212.197.9)  2.522 ms  2.636 ms  2.917 ms
     4  uls-2-3-uls-2-2.turktelekom.com.tr (81.212.197.202)  2.173 ms  2.715 ms  2.811 ms
     5  ln-col-1-uls-2-3.turktelekom.com.tr (212.156.103.66)  90.077 ms  90.141 ms  90.253 ms
     6  212.156.103.46.static.turktelekom.com.tr (212.156.103.46)  74.491 ms  73.398 ms  73.460 ms
     7  xe-0-2-0-0.lts-96cbe-1b.ntwk.msn.net (207.46.42.220)  73.750 ms  73.832 ms  73.923 ms
     8  207.46.45.225 (207.46.45.225)  156.284 ms  156.349 ms  156.486 ms
     9  * ge-7-0-0-0.nyc-64cb-1a.ntwk.msn.net (207.46.47.20)  161.329 ms  161.272 ms
    10  xe-8-3-0-0.sn1-96cb-1b.ntwk.msn.net (207.46.45.115)  190.514 ms  190.486 ms *
    11  * * *
    12  * * *
    13  * * *
    14  * * *
    15  * * *
    16  * * *
    17  * * *
    18  * * *
    19  * * *
    20  * * *
    21  * * *
    22  * * *
    23  * * *
    24  * * *
    25  * * *
    26  * * *
    27  * * *
    28  * * *
    29  * * *
    30  * * *

    Friday, June 15, 2012 7:20 AM
  • Hi Alper,

    When I connect to the host "xmpp.messenger.live.com", I get a see-other-host redirection to one of our actual XMPP servers. Following that redirection allows me to log in successfully. As posted here (http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/thread/7eaf267f-bcc4-48c4-a3a3-e58455a7378a), XMPP clients should support see-other-host to connect to Messenger's XMPP service.

    A traceroute will not reliably show a problem connecting to services behind a firewall, so can you share a client-side trace of what you see happening? You can post here, or email it to bgarrett (at) Microsoft (dot) com.

    Thanks,

    Bill

    Friday, June 15, 2012 3:49 PM
  • Hello Bill,

    Thanks for your care. I'll send a trace between my application (SNGW) and Msn xmpp service. 

    Check your e-mail,please.

    Best Regards,

    Alper Ozdamar

    Monday, June 18, 2012 7:19 AM
  • I received the trace and am looking at it.

    Thanks,

    Bill

    Monday, June 18, 2012 8:06 PM
  • I see two exchanges and one attempt to open a connection. Everything your client is doing looks correct.

    The first exchange: a DNS query for a SRV record for _xmpp-client._tcp.messenger.live.com. The response is xmpp.messenger.live.com on port 5222. The request and response are both correct.

    The second exchange: a DNS query for an A record for xmpp.messenger.live.com. The response includes three A records, and your client chose gateway.messenger.hotmail.by2.nc.messenger.msn.com.nsatc.net (64.4.9.190).

    The client then tries to connect to that address, and performs two SYN retransmits before giving up. The destination IP and port number look correct.

    Using a test client, I tried to make the same connection locally and was sent to our service front door. So the service is responding on the XMPP service port. I was able to make the same connection from a remote test server. So at this point, my best suggestion is to verify with your Internet service provider(s) that they are not blocking this traffic. I'll ask here to see if anything has changed which might affect this.

    Thanks,

    Bill

    Monday, June 18, 2012 8:47 PM
  • Hello ,

    I have a same problem.

    I Test "Android XMPP clinet Sample" and I got some Error Message.

    How do I Fix this ?

    java.security.KeyStoreException: KeyStore jks implementation not found
    at java.security.KeyStore.getInstance(KeyStore.java:119)
    at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:61)
    at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:833)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
    at org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
    stream:error (see-other-host)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:261)
    at org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
    No response from the server.: 


    Tuesday, June 19, 2012 2:45 AM
  • Hi

    I fixed some error about "keystore jks"

    I change "jks" into "bks" and  I got other error message

    XMPPError establishing connection with server.: remote-server-error(502) XMPPError establishing connection with server.
      -- caused by: javax.net.ssl.SSLException: Connection closed by peer
    at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:709)
    at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:842)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
    at org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
    Nested Exception: 
    javax.net.ssl.SSLException: Connection closed by peer
    at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474)
    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:750)
    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:692)
    at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:677)
    at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:842)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
    at org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)

    Tuesday, June 19, 2012 6:09 AM
  • Hi Peter,

    I see two issues in the stack traces you posted.

    1. "stream:error (see-other-host)". As posted here (http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/thread/7eaf267f-bcc4-48c4-a3a3-e58455a7378a), XMPP clients will need to support the XMPP see-other-host redirect mechanism to connect to Messenger. This may require some additional client work, if Smack does not already support this internally.

    2. Keystore-related errors ("KeyStore jks implementation not found"). A quick Web search suggests that you will experience these issues using Smack on the Android platform. From your message, I can't tell whether you are developing on Android or not. This would be a question to ask the Smack community, or Android users if that is your target platform. It looks like there might be some extra steps your client needs to take if you plan to use the Bouncy Castle keystore (BKS) - documentation at bouncycastle.org should have more information.

    Hopefully this has been helpful.

    Thanks,

    Bill

    Tuesday, June 19, 2012 5:44 PM
  • Hi Alper,

    I received a second trace from you. This time I see your client successfully connecting to our service, then negotiating TLS. Anything that happens after that is obscured because the traffic is happening over a secure channel. So it seems that the firewall configuration change was successful.

    If you are still having problems fully establishing a connection, you will need to look at any logs your client itself is producing (or can produce) - network captures won't help once TLS is established.

    Without seeing such logs, I would guess that what you are receiving is a see-other-host stream error. Your client must be prepared to handle this, and reconnect to another server when it receives this error. See here for details: http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/thread/7eaf267f-bcc4-48c4-a3a3-e58455a7378a

    Thanks,

    Bill

    Tuesday, June 19, 2012 7:26 PM
  • Hello again Bill,

    We are trying to implement "see-other-host" issue. When we tried to connect to "xmpp.messenger.live.com" address, we are getting no response from server. We couldn't decide other-host so our application couldn't connect to msn xmpp service, successfully. By the way we are using smack API. 

    Is there  a problem in your xmpp service ? 

    Best Regards, 

    Alper


    Friday, July 20, 2012 12:31 PM
  • Hey Alper,

    Check the raw received packets in the debug window, the see-other-host stream error is probably there.

    Smack doesn't handle see-other-host yet http://community.igniterealtime.org/message/223550

    You'd have to alter smack code for now as a workaround, and intercept the error.

    Regards,

    Alvaro

    Friday, July 20, 2012 2:58 PM
  • Hi Alper,

    As Alvaro replied, the Smack library does not yet support handling the "see-other-host" stream error. Please work with the Smack authors and support community on getting support for this.

    Thanks,

    Bill

    Friday, July 20, 2012 5:26 PM
  • Hello guys,

    I added see-other-host support to SMACK API for try. Now i can get see-other-host address as an Exception. For Example when i try to connect to messenger.live.com address i'm successfully getting see-other-host : BAYMSG1020118.gateway.messenger.live.com .

    Then i try to connect BAYMSG1020118.gateway.messenger.live.com , i'm getting see-other-host again with different address: BY2MSG4010610.gateway.messenger.live.com

    Finally when i try to connect BY2MSG4010610.gateway.messenger.live.com , i'm getting this exception : 

    No response from the server.: 
    java.lang.NullPointerException
    at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:73)
    at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:211)
    at org.jivesoftware.smack.Connection.login(Connection.java:348)
    at com.ms.wlm.XmppClient.logIn(XmppClient.java:161)
    at com.ms.wlm.Program.main(Program.java:62)

    I'll share this result with Smack guys also. If you want, I can send to you the capture of our xmpp traffic via email. 

    When i digged into that last EXCEPTION. it is saying that "Unknown To Jid in the open stream stanza"

    Best Regards,

    Alper Ozdamar


    Monday, July 30, 2012 11:03 AM
  • public class XmppClient {
    
        public static final int Port    = 5222;
        public static String    Service = "messenger.live.com";
        private String          accessToken;
        private XMPPConnection  connection;
    ...
    ...
    ...
    
        /**
         * Log in the client to the messenger service.
         */
        public void logIn() {
    
            // Create a connection. We use service name in config and asmack will do
            // SRV look up locate the xmpp server.
            ConnectionConfiguration connConfig = new ConnectionConfiguration(XmppClient.Service);
    
            // ConnectionConfiguration connConfig = new ConnectionConfiguration(XmppClient.Host,
            //                                                                XmppClient.Port);
            connConfig.setRosterLoadedAtLogin(true);
            this.connection = new XMPPConnection(connConfig);
    
            try {
                this.connection.connect();
                System.out.println("PacketReader.seeOtherHost:" + PacketReader.seeOtherHost);
                this.Service = PacketReader.seeOtherHost;
    
                // We do not need user name in this case.
                this.connection.login("",this.accessToken);
    
            } catch (XMPPException ex) {
                this.connection = null;
                System.err.println("XMPPException occured:" + ex);
                this.Service = PacketReader.seeOtherHost;
                this.logIn();
                return;
            }
    ...
    ...

    The code above, i can catch see-other-host stream-error and successfully getting the see-other-host value. (For example:BAYMSG1020118.gateway.messenger.live.com

    I wrote some code in smack library for this. ( in PacketReader.java)

    After that as you see, i am setting seeOtherHost value to XMPPClient's Service attribute. 

    this.Service = PacketReader.seeOtherHost;

    Then i try to connect msn service again.

               this.connection.login("",this.accessToken);

    After that In case of exception i setting Service attribute again. (In case of new see-other-host error)

    catch (XMPPException ex) {
                this.connection = null;
                System.err.println("XMPPException occured:" + ex);
                this.Service = PacketReader.seeOtherHost;
                this.logIn();
                return;
            }

    But in second try i'm getting "Unknown To Jid in the open stream stanza"

    My console output:

    FIRST TRY :

    next--TEXT : BY2MSG4020714.gateway.messenger.live.com

    stream:error (see-other-host)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:263)
    at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:74)
    in thread run exception catched: 
    PacketReader.seeOtherHost:BY2MSG4020714.gateway.messenger.live.com

    XMPPException occured:No response from the server.: 

    SECOND TRY : 

    Text:<stream:error xmlns:stream="http://etherx.jabber.org/streams">

    nextText: 
    nextText: Unknown To Jid in the open stream stanza
    stream:error (text)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:263)
    at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:74)

    Am i doing something wrong ? Waiting for your comments ?

    Best Regards, 

    Alper Ozdamar

    Tuesday, July 31, 2012 2:07 PM
  • Hi Alper,

    You should be changing the Host value, not Service. Service should always be "messenger.live.com", as the domain JID that Messenger is using.

    Thanks,

    Bill

    Thursday, August 2, 2012 1:45 AM
  • Hello Bill,

    I appreciate you. Know, i can login into MSN xmpp service via smack API. 

    Thanks,

    Alper Ozdamar

    Friday, August 3, 2012 12:42 PM