How to advertise/discover advertised name only on the same machine

asked 2014-05-01 16:12:56 -0700

mattpho gravatar image

Hi, I am using Windows 7 SDK 14.02 and try to limit the advertisement/discovery of client/server to the same machine because if multiple developers is working on the same code using the same advertise name, they interfere with each other. I tried using all combinations of TRANSPORT_ANY and TRANSPORT_LOCAL in the client and server but if TRANSPORT_LOCAL is used, the client can't discover the server. I guess TRANSPORT_LOCAL means both client and server need to connect to the same router but in Windows each has its own router, correct? If so, how to force them to use the same router? If not, anyway to force routers to talk to the other ones on the same machine?

Thank you Matt

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-02 16:47:41 -0700

bspencer gravatar image

You are correct about TRANSPORT_LOCAL being only on the same AllJoyn Router. If you just want to discover the instance on your local machine then change the wellknown name you search for to match what you have on the other side. You should never have a production application that advertises the exact same wellknown name. In the samples we DO have this as a case because it is easier to avoid the UI input of entering a name or asking for this. It reduces the amount of code for the basic sample. You will always want to have either a random value attached to the wellknown name in order to avoid a collision as you are seeing. One simple way is to append a user entered value + the BusAttachment::GetGlobalGUIDString. If you are doing development and want to avoid user entry then just append the GUIDString value and change the wellknown name prefix to something different for your efforts. I believe at the end of the day you want a many to many interaction so you will want multiple services advertising in the same proximal network, so adding a random value is what you should do.

Another option you have is to switch the advertise/discovery over to service level discovery and use the About feature: https://allseenalliance.org/docs-and-downloads/documentation/alljoyn-about-feature-10-interface-specification .

Then you can filter based of the friendly name for your development efforts.

edit flag offensive delete publish link more


Hi, I found another flag SessionOpts::PROXIMITY_PHYSICAL which should only allow sessions created on the same physical machine but it doesn't seem to work either (use it on both service and client). If it is not used to allow connecting on the same machine, what does it do? Thank you Matt

mattpho ( 2014-05-12 15:46:27 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-05-01 16:12:56 -0700

Seen: 99 times

Last updated: May 02 '14