AnsweredAssumed Answered

Connection closed with error after a while in android

Question asked by cpacm on May 22, 2015
Latest reply on Mar 1, 2016 by Darshana

After connect a while ,the application cause this error ——"Connection closed with error"

this is my connection configuration

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setServiceName(XMPPConfig.SERVICENAME);
configBuilder.setHost(XMPPConfig.HOST);
configBuilder.setPort(XMPPConfig.PORT);
configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
connection = new XMPPTCPConnection(configBuilder.build());
connection.setPacketReplyTimeout(XMPPConfig.TIMEOUT);

 

and this is the error:

java.net.SocketException: Connection reset by peer
            at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method)
            at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273)
            at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:461)
            at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85)
            at java.io.InputStreamReader.read(InputStreamReader.java:255)
            at java.io.BufferedReader.read(BufferedReader.java:311)
            at org.kxml2.io.KXmlParser.peek(KXmlParser.java:925)
            at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:589)
            at org.kxml2.io.KXmlParser.nextImpl(KXmlParser.java:333)
            at org.kxml2.io.KXmlParser.next(KXmlParser.java:1378)
            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1151)
            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
            at java.lang.Thread.run(Thread.java:1027)

Outcomes