powered by Jive Software

Getting exception as Connection Reset By Peer at sometimes while using Smack 4.2.0

I am using ejabberd with Smack 4.2.0 at android client side and at times I am getting this exception,

Connection XMPPTCPConnection[user1@test/test] (2) closed with error

java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:588)

at libcore.io.IoBridge.recvfrom(IoBridge.java:552)

at java.net.PlainSocketImpl.read(PlainSocketImpl.java:481)

at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)

at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)

at java.io.InputStream.read(InputStream.java:162)

at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:194)

at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:153)

at java.io.InputStreamReader.read(InputStreamReader.java:233)

at java.io.BufferedReader.read(BufferedReader.java:325)

at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:42)

at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515)

at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992)

at org.kxml2.io.KXmlParser.next(KXmlParser.java:349)

at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1228)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:980)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:996)

at java.lang.Thread.run(Thread.java:818)

Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)

at libcore.io.Posix.recvfromBytes(Native Method)

at libcore.io.Posix.recvfrom(Posix.java:189)

at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250)

at libcore.io.IoBridge.recvfrom(IoBridge.java:549)

at java.net.PlainSocketImpl.read(PlainSocketImpl.java:481)

at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)

at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)

at java.io.InputStream.read(InputStream.java:162)

at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:194)

at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:153)

at java.io.InputStreamReader.read(InputStreamReader.java:233)

at java.io.BufferedReader.read(BufferedReader.java:325)

at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:42)

at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515)

at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992)

at org.kxml2.io.KXmlParser.next(KXmlParser.java:349)

at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1228)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:980)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:996)

at java.lang.Thread.run(Thread.java:818)

Please help in understanding when this exception is raised and what are the probable reasons.