GCMCCS(xmpp)在java中使用smack库实现与gcm.googleapis.com的连接失败

busg9geu  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(317)

我正在试用gcm来实现android客户端和java服务器应用程序之间的通信。我使用基于xmpp的gcm,因为我需要异步的、双向的消息。
在我的客户方面,1。googleplay服务检查显示需要更新。

google play services is out of date. Requires 4242000 but found 3136130

api等级-17,使用avd和谷歌api,android 4.2.2谷歌播放服务修订版15,我如何解决这个问题?
但我可以成功注册设备。
在服务器端,我使用2。我使用的是smacklibrary 3.4.1,我使用的是googledocs中的示例代码。我得到以下错误

gcm.googleapis.com:5235 Exception: XMPPError connecting to gcm.googleapis.com:5235.; : remote-server-error(502)
  -- caused by: XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
  -- caused by: java.net.ConnectException: Connection timed out: connect
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:592)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Nested Exception: 
XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
  -- caused by: java.net.ConnectException: Connection timed out: connect
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:565)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Nested Exception: 
java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:557)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Exception in thread "main" java.lang.IllegalStateException: Not connected to server.
    at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:483)
    at SmackCcsClient.send(SmackCcsClient.java:131)
    at SmackCcsClient.main(SmackCcsClient.java:356)

我已经签了上游消息的表格。但审批仍在等待中。但是连接本身在这里失败了。我怎样才能解决这个问题。
请帮帮我!提前谢谢!!

kqhtkvqz

kqhtkvqz1#

这个 ERROR CODE 502 意味着连接服务器有问题,可能有几个原因,但一些常见的问题是,
1 ) FIREWALL PROBLEM ----[正确配置防火墙]
2)服务器内部错误----[请稍后重试]

相关问题