I'm developing a chat application in android. Using XMPP server. PHP server has been migrated to ejabber.
My notification works properly in all scenarios. But in one case I am losing the XMPP messages. In fact I am not getting notifications.
In detail, I am turning off the WiFi or data connection. and after turning off WiFi or data connection any notification sent to me that is not getting. after when I turn ON the WiFi or data connection, I am not able to get the messages which were sent to me.
I have implemented service in background. that makes xmpp connection always live.
I getting this error while i turn OFF the WiFi connection.
java.net.SocketException: sendto failed: EPIPE (Broken pipe)
java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)
at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506)
at libcore.io.IoBridge.sendto(IoBridge.java:475)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:508)
at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:270)
at java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:167)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:158)
at java.io.BufferedWriter.flush(BufferedWriter.java:124)
at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:286)
at org.jivesoftware.smack.PacketWriter.access$12(PacketWriter.java:270)
at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:137)
Caused by: libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:146)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
at libcore.io.IoBridge.sendto(IoBridge.java:473)
... 9 more
at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:552)
at libcore.io.IoBridge.recvfrom(IoBridge.java:516)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:489)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:241)
at java.io.InputStreamReader.read(InputStreamReader.java:244)
at java.io.BufferedReader.read(BufferedReader.java:310)
at org.jivesoftware.smack.XMPPConnection$AliveReader.read(XMPPConnection.java:1122)
at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1496)
at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:979)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:346)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:310)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:321)
at org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:216)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Caused by: libcore.io.ErrnoException: recvfrom failed: ETIMEDOUT (Connection timed out)
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:131)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
at libcore.io.IoBridge.recvfrom(IoBridge.java:513)
... 13 more