Search code examples
androidiosnetwork-programmingupnp

logic: how to search a local network for a custom service


I'm not familiar with networking terminology so it makes it difficult searching for an answer without the right keywords.

My curiosity is picking at me again after seeing how media servers work. I'm wondering what methods there are to:

  1. (from a client, be it PC, Android or iOS) send out a "ping" of some sort to the whole network to a destination port
  2. when a server/service acknowledges this ping on a certain port, it'll respond to the client and say "hey im here!"
  3. client lists out the servers that have responded and allows the user to select one

With the suggested method, I'm wondering if:

  1. possible without scanning the ports from 192.168.0.1 -> 192.168.1.254 (which is very bad in my opinion)
  2. any caveats? such as possible security or logic flaws that can be exploited
  3. cause unwarranted load to the network (even if it's just 2 or 3 clients searching the network once a day)
  4. (edit) Ideally, the solution would require minimal input from the potentially non-technical user (other than pressing "find device" from the client) so "it just works"

If there is an existing question/answer please feel free to point me that way.

Edit: From some extra research, it seems uPNP seems to be the way to go.


Solution

  • A possible solution strictly for network-based media services is to look into standard discovery & streaming protocols such as DLNA.