0

When Session lost, connect again until I explicitly end session

asked 2014-09-08 06:05:29 -0700

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi,

My Android app require to share real time data from one device to another. Sometimes session is lost and app stops working. Is there any way to handle session on lost that i can create same group again in background until i explicitly end session.

Thanks.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-09-08 11:28:44 -0700

Nikhil Dabhade gravatar image

updated 2014-09-09 17:51:40 -0700

Hi Vym,

As I understand your question, you want the same peers to be a part of a session so that the sharing of real time data can continue over the new session.

Some background, a session can be lost due to multiple reasons 1. The session host went out of range of Wifi 2. The others peers of the session went out of range 3. The session host did a leave session 4. The other peers did a leave session and only the session host was left in the session 5. Some application dependent condition got executed. 6. The policy on your device shut down the active TCP connection between the host and peers 7. Generic AllJoyn error(rare)

As you seem to well know that one can detect session lost through the use of SessionLost callback which is a part of the SessionListener. The SessionLost is an indication that the session is already lost. You doing an explicit session lost will no

If the host of the session is out of range there is nothing one can do about it since it is not in network range and thus unreachable.

For a session lost due to any other reason you could have all the peers initially advertise the same prefix followed by their GUIDs. The peer with the highest GUID gets to be the session host. If a session is lost the next peer with the highest GUID gets to be the session host and all other peers can attempt to connect to that peer. The catch is the old host may or may not be a a part of this new session if he had moved away from the network range or had his wifi turned off.

Hope that helps you in some way.

Let me know if you have more questions.

Regards,
Nikhil

Updated: After looking at the logs posted by the Vym

  1. The app seems to be using PeerGroupManager which is something that has not been maintained and actively supported since almost a year. There could be bugs in there which could show up unexpectedly. If possible I would suggest using traditional AllJoyn instead of PeerGroupManager until someone takes up the task to update and support it.

  2. The probe message being sent out is not being replied to correctly and giving out errors which leads to the remote endpoint being removed and thus the session being lost.

I would suggest using core AllJoyn APIs rather than PeerGroupManager at this point. A good starting point would be the samples in the core SDK or just look for alljoyn_core/samples/basic The AllJoyn concept remain the same where you will still have a session but there is some boiler plate code that needs to be put in. The samples should be able to help you there. If you have any problems proceeding let me know and I can help you.

edit flag offensive delete publish link more

Comments

Hi Nikhil, Thanks a lot for ur reply. My app is student teacher teaching session. Here teacher screen data is reflacted to student. I create group according to subject. For following code its Tulip_Subject_122. Session breaks randomly so my whole app architecture get break. Can you suggest a right way to deal with this issue. Plz check following log. Can you point me what might gone wrong in my case: 09-08 15:35:26.906: I/PeerGroupManager(21724): getSignalInterface(): 09-08 15:35:26.906: I/PeerGroupManager(21724): getSessionId(Tulip_Subject_122): -787311065 09-08 15:35:26.906: V/BusHandler(21724): simpleInterface check 09-08 15:35:26.906: V/BusHandler(21724): simpleInterface != null 09-08 15:35:26.921: E/ALLJOYN(21724): 257.309 ** ERROR ALLJOYN iodisp .../src/Message_Parse.cc:1006 | 0x0004 09-08 15:35:26.921: E/ALLJOYN(21724): 257.309 ** ERROR ALLJOYN iodisp .../src/RemoteEndpoint.cc:635 | 0x0004 09-08 15:35:26 ...(more)

Vym ( 2014-09-08 23:39:46 -0700 )edit

Hey thanks for informing and updating the answer. But app is almost complete and i wasn't getting errors before.It would be great if u can help me with PeerGroupManager or suggest best replacement way rather replacing whole alljoyn new api.Bcoz i dont hv more time as i hv to deliver it soon :( Thnks

Vym ( 2014-09-17 02:57:37 -0700 )edit
0

answered 2014-09-08 23:38:10 -0700

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi Nikhil,

Thanks a lot for ur reply. My app is student teacher teaching session. Here teacher screen data is reflacted to student. I create group according to subject. For following code its Tulip_Subject_122. Session breaks randomly so my whole app architecture get break. Can you suggest a right way to deal with this issue.

Plz check following log. Can you point me what might gone wrong in my case:

09-08 15:35:26.906: I/PeerGroupManager(21724): getSignalInterface():

09-08 15:35:26.906: I/PeerGroupManager(21724): getSessionId(Tulip_Subject_122): -787311065

09-08 15:35:26.906: V/BusHandler(21724): simpleInterface check

09-08 15:35:26.906: V/BusHandler(21724): simpleInterface != null

09-08 15:35:26.921: E/ALLJOYN(21724): 257.309 ** ERROR ALLJOYN iodisp .../src/Message_Parse.cc:1006 | 0x0004

09-08 15:35:26.921: E/ALLJOYN(21724): 257.309 ** ERROR ALLJOYN iodisp .../src/RemoteEndpoint.cc:635 | 0x0004

09-08 15:35:26.924: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.924: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.925: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.925: I/PeerGroupManager(21724): PGSessionListener.sessionMemberRemoved(-787311065, :yrE4ctqG.2):

09-08 15:35:26.926: I/PeerGroupManager(21724): PGSessionPortListener.onSessionMemberRemoved: (-787311065, :yrE4ctqG.2)

09-08 15:35:26.926: I/PeerGroupManager(21724): removePeer(-787311065, :yrE4ctqG.2):

09-08 15:35:26.926: I/PeerGroupManager(21724): getSessionId(Tulip_Subject_122): -787311065

09-08 15:35:26.926: I/PeerGroupManager(21724): getPeers(Tulip_Subject_122): SessionID - -787311065

09-08 15:35:26.926: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.926: I/PeerGroupManager(21724): listHostedGroups(): []

09-08 15:35:26.926: I/PeerGroupManager(21724): getPeers(): [:DlWSyOey.2]

09-08 15:35:26.926: I/PeerGroupManager(21724): getNumPeers(Tulip_Subject_122): numPeers - 1

09-08 15:35:26.926: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.927: E/NETWORK(21724): 257.315 ** ERROR NETWORK iodisp common/os/posix/Socket.cc:400 | 0x0004

09-08 15:35:26.930: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.930: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.931: I/PeerGroupManager(21724): PGSessionListener.sessionLost(-787311065):

09-08 15:35:26.931: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.931: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.931: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.931: D/dalvikvm(21724): threadid=41: interp stack at 0x56949000

09-08 15:35:26.931: D/dalvikvm(21724): threadid=41: bye!

09-08 15:35:26.937: I/PeerGroupManager(21724): PGSessionPortListener.onSessionLost: (-787311065)

09-08 15:35:26.937: I/PeerGroupManager(21724): PGSessionListener.groupLost(Tulip_Subject_122):

09-08 15:35:26.938: I/PeerGroupManager(21724): listFoundGroups(): [Tulip_Subject_122]

09-08 15:35:26.938: I/PeerGroupManager(21724): listHostedGroups(): []

09-08 15:35:26.938: I/PeerGroupManager(21724): listJoinedGroups(): []

09-08 15:35:26.938: I/PeerGroupManager(21724): listLockedGroups(): []

09-08 15:35:26.939: I/System.out(21724): mUIHandler Available: [Ljava.lang.String;@4414e350, Hosted: [Ljava.lang.String;@4414e368, Joined ... (more)

edit flag offensive delete publish link more

Comments

Thank you for posting the logs across. Whenever possible we try to post the logs in the original post by editing it. That saves another answer being created for logs in the thread or you could always upload it and point to the link :)

Nikhil Dabhade ( 2014-09-09 17:53:51 -0700 )edit

Hey thanks for informing and updating the answer. But app is almost complete and i wasn't getting errors before.It would be great if u can help me with PeerGroupManager or suggest best replacement way rather replacing whole alljoyn new api.Bcoz i dont hv more time as i hv to deliver it soon :( Thnks

Vym ( 2014-09-09 22:59:55 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-09-08 06:05:29 -0700

Seen: 1,329 times

Last updated: Sep 09 '14