On my android device, when I go to add a printer, ...
# random
c
On my android device, when I go to add a printer, it's able to find a printer because its on my local network and it shows its IP. How does it do that? Does it someone scan every IP address on my network, or does it use dns or something to figure out what devices are on my network? im trying to build something similar where I can have two android devices on the same local network and they are able to find each other if one of them runs a server to serve content for example.
e
Look into broadcast and multicast
c
"DNS-based Service Discovery" oooh. so i was sorta on the right track.
i guess you cant just do it with like an http client like okhttp/ktor. hmmm
j
Yeah, you need to use some form of service discovery first. Then you can use the address of the identified peer to connect using a client.
c
awesome. ill give this a shot.
e
c
I took a look at that and eventually I do want to move to that. I want to be able to support BT and Wifi. nearby does support both, except not BT on ios (which is weird), but also nearby and cross platform sdk seem to be dead. no traction in the past 2 years. https://developer.android.com/guide/topics/connectivity/cross-device-sdk/overview
seems like id be able to go kinda far with just http server on one device on a local network. we'll see how it goes 🤞