0

what effect lostAdvertisedName has?

asked 2014-05-23 20:55:12 -0700

europelee gravatar image

hi, use 14.02, and alljoyn-android java, my case is : a service app A, a client app B, and A push audio file to B by session-signal, while B would recv, and at the same time playing music(B has a BusSignalHandler for recving bytes sent from A, then save bytes into a buff, another thread in B code for playing music read data from buff.)

i find B often call lostAdvertisedName while B playing music(although in fact B already finish recving audio file, lostAdvertisedName has nothing effect on playing music ), and a session still exist(because I find A and B never call sessionLost), so what effect lostAdvertisedName has, it seems nothing effect?

and what trigger lostAdvertisedName, depend timeout?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-05-24 06:43:15 -0700

bspencer gravatar image

In the current advertisement/discovery process in 14.02 over Wi-Fi there is a handshake of WHO-HAS and IS-AT UDP packets. When an application advertises the wellknown name it sends out an IS-AT packet. When an application makes a call to FindAdvertisedName it sends out a WHO-HAS packet. The service side, advertiser of the wellknown name, every 120 seconds will send out a IS-AT as a heartbeat. When an application that has discovered a wellknown name has not received the IS-AT when it expects it should then lostAdvertisedName will be executed.

It is important to understand that in the AllJoyn 14.02, and previous versions, the wellknown name is a hint that a service exists. It does not guarantee that it is still around, IE the device could walk away from Wi-Fi and does not send a cancel so it will take a statistical average of 60 seconds to be informed, if not in a session. Once you are joined in a session you have a reliable communication with the other side. This is why if you receive a LostAdvertised name AND you are in a session, you can ignore it because why has happened is that the UDP packet could have been dropped OR the discovering or advertising application is doing something that is blocking and causes the AllJoyn Router software to block.

In your case, you can ignore the lostAdvertisedName. What you will find is that foundAdvertisedName will be called again shortly after the lostAdvertisedName callback to let you know that the device is still around.

Since you are doing something with Audio you may want to check out the AllJoyn Audio service. This will allow you to interoperate with other products that support the service and already takes into account quite a few error conditions and has an OK level of synchronization.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-05-23 20:55:12 -0700

Seen: 98 times

Last updated: May 24 '14