Is there a way to use ktor client to search the lo...
# ktor
c
Is there a way to use ktor client to search the local network for all local devices?
a
This doesn't look like a client problem but a server problem. Whats the use case here?
c
The use case is that on my local network I start a server. Now I want the client to find the local server without knowing the devices IP before hand.
a
since this client runs on the server itself, you can check the available open ports then, and try making a request on each one until you get the results you expect
in linux
Copy code
netstat -tulpn | grep LISTEN
should do the trick. There should be an equivalent for macos and windows as well
c
the client and the server are separate devices. so I can indeed have the client connect to the server, if I hardcode the IP address of the servers local IP on the client.
i.e. i have one android device running the server code. and then have another android device running the client code
a
So are you asking if your client code, can scan open ports on another device???
c
Correct. Kinda of like when I'm on my wifi network on my android device. And I hit print. It scans my network and shows me the 1 printer on my network with it's IP.
maybe what i want is dns scanning?
a
What you are requesting has a major security vulnerability. And since you are dealing with android devices which security is one of it's first approach, I don't think you will be able to get open ports of one android device by scanning it form another android device. I am sure you can get it if you are scanning from the same device (and possibly somehow publish your available ports), but from a different device? its gonna be challenging for sure
c
I started a thread in #random since it seemed like ktor wouldn't help me here. looks like it is possible, thanks for the help anderson!
a
Anytime Colton