Could Not Connect XMPP Server with smack : EOF Exception when implementing GCM XMPP-based App Server

StackOverflow https://stackoverflow.com/questions/18318398

java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen ...</mechanisms></stream:features>... @1:344
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)

//resources : https://developer.android.com/google/gcm/ccs.html#implement

I have tried the exact code which is given in the android website, but it is throwing the end of file exception which i am thinking as some bug in MXParser(not quite sure though). If smack XMPP library is the problem, Is there any other xmpp library which i can use for GCM CCS ? Could any one please help me fix this . In the below image you can see the end stream tag is not closed but this is how i am receiving the packets.

sent and received packets Output windows:

sent packets

received packets

有帮助吗?

解决方案

For some reason, I have restarted the machine and it got fixed by itself

其他提示

One possible cause is described here:

You need to send some heartbeat - either at XMPP or TCP level - so your endpoint can detect (or prevent) the closed TCP. Many router/NATs fail to send RST or FIN, just drop the TCP connection.

For example, you may use PingManager (smack-extensions) to implement such a heartbeat.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top