kumarsujit / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Auto reconnection seems working not so good #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What are you doing to produce the error?
1. try setting a ConnectionListener on connection and try to connect with 
an android device 
2. try to switch to wifi and then to 3g again
3. try to send chat message

What is the expected output?
the message should be received.

What do you see instead? (Please attach a debug enabled logcat)
Connection status ok (no failure)

What version of aSmack / Android / Device do you use?
2010.03.03 and android 1.6 device

What server do you use? Is there a public server to reproduce the problem?
Gtalk server

What else might help us to reproduce and hunt down the problem?
I have to say that the library does not work as good as the library 
(modified maybe) used by gtalk default android application. 

Original issue reported on code.google.com by tobia.loschiavo on 28 Mar 2010 at 6:53

GoogleCodeExporter commented 9 years ago
I am using XMPPConnection. Could a boshConnection provide a more reliable 
connection
to server?

Original comment by tobia.loschiavo on 30 Mar 2010 at 7:41

GoogleCodeExporter commented 9 years ago
The problem is at the lowest level: TCP. The TCP phone stack is designed to 
survive a
handover to a new cell, in a train. Which means it's design to survive multiple
minutes of silence.

This is contrary to "real-time". Here is a good/common workaround: implement 
server
ping and check for fast replies, drop the connection / reconnect.

You can either look into the jabbroid code for ping or into the buddycloud code 
for
reader/writer based checking (hint: the reader/write is "protected" in asmack, 
so
extending the XMPPConnection class may help).

BOSH has stream management "for free". So it might help to use it (at least for
delivery reliability.)

WontFix the ticket because it's not an asmack bug but rather a TCP level 
problem.

Regards,
  René

PS: gtalk uses a modified smack lib, too. But I'm still far from the same 
stability.
Help would be appreciated.

Original comment by rtreffer@gmail.com on 3 Apr 2010 at 2:32

GoogleCodeExporter commented 9 years ago
Hi Rene, thanks for your answer. I was looking at buddycloud code...just to be 
clear, 
the code you were talking about is a sort of scheduler that checks the status 
of a 
connection and reconnect eventually right? Is this heavy for battery 
consumption? 
About this I am trying to understand wich system is the best for 
reliability/battery 
ratio. Indeed soon I would like to create an open project based heavily on xmpp 
but 
first we have to solve these problems. Anyway if you want help, I would be glad 
to 
help you for the sake of open source and open protocols.

Original comment by tobia.loschiavo on 3 Apr 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Regard help: I'm always happy merge smack improvements. And to get feedback. My 
trunk
is at [http://github.com/rtreffer/smack github/rtreffer/smack] and
[http://github.com/rtreffer/smack github/rtreffer/asmack], so feel free to fork.

Upstream patches to smack will be merged as well. Go ahead and push everything 
you
might regard as usefull and I'll try to pull it in. Just one note: I'll keep it 
under
the Apache Licence. As I want to maximalize the use of the lib.

As for best practices: I'll try to create some sample code, for chat / 
reconnect, but
it's not post-login atm....

Original comment by rtreffer@gmail.com on 4 Apr 2010 at 8:05

GoogleCodeExporter commented 9 years ago
I have done the next test:

- start openfire
- start client
- shutdown and start openfire
- send packet from client

And I get:
 connectionClosedOnError
 java.io.IOException: Write error: I/O error during system call, Broken pipe
     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativewrite(Native
Method)
     at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.access$600(OpenSSLSocket
Impl.java:54)
     at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLOutputStream.write(Op
enSSLSocketImpl.java:568)
     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:183)
     at java.io.OutputStreamWriter.convert(OutputStreamWriter.java:263)
     at java.io.OutputStreamWriter.write(OutputStreamWriter.java:252)
     at java.io.BufferedWriter.flush(BufferedWriter.java:145)
     at org.jivesoftware.smack.util.ObservableWriter.flush(ObservableWriter.java:48)
     at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:195)
     at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:42)
     at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:78)

So, at this moment asmack knows that the connection is broken and it is still 
not
reconnecting. I think that in this error the asmack could recover from crash 
starting
the reconnecting.

Im sorry if I haven't understood well but I hope this will help.

I have used asmack-2010.05.07.jar

Original comment by cver...@gmail.com on 1 Jun 2010 at 3:13

GoogleCodeExporter commented 9 years ago
I was annoyed with some of the wifi problems on my android, so I developed an 
app to solve them.

It's called "Fix My WiFi", and it Resolves these WiFi issues:

1) Re-connect failing on return to Access Point, or after conn drops.
2) WiFi dropping when phone left idle (Optional WiFi lock)
3) Access point available, but device not attempting to conn.

You can download it from the market.

Hope it helps!

Original comment by christian.zangerl@gmail.com on 12 Aug 2010 at 10:29