2

What are some strategies for a client to discover a service?

For example, we have a client that wants to connect to a service (assuming they are on same subnet on the same network), what's a good way to discover that a service is running and then therefore the client will attempt to connect to it?

Would we want the client to broadcast often and wait for the service to respond? Or would we have the service broadcast often and have the client listen?

I would think we would want the service to broadcast itself and have the client listen.

What's standard practice for this?

The service for example will be something like a music player that plays music when a client remote controls to it via wifi/network. Think of iTunes Remote for iPhone controlling the iTunes player on a PC/MAC.

LB.
  • 13,730
  • 24
  • 67
  • 102

1 Answers1

1

There are two parts to your question:

  • How to locate the service?
  • How to discover if the service is running?

The normal way to tell if a service is running is to attempt to connect to it.

So how to locate it? Normally you'd want to avoid broadcasting. Typical approaches are:

  • Configure the name of the server on the client.
  • Add a custom DHCP option; the client can query the address of your server from the DHCP server.

If you do broadcast, it's normal for the client to send the query. This gives you a single broadcast each time a new client joins the network, as opposed to continuous broadcasts (and a delay at the client) if the server is advertising its location.

arx
  • 16,686
  • 2
  • 44
  • 61