I need to build an app to communicate between my android phone (client) and an application on my PC (server) via TCP/IP Sockets. When the user starts the app, I'd like it to automatically detect the available servers running over the same Wi-Fi.
My question is: - How does the app on my phone find the server without me having to input the IP of the server.
Thanks.
It's impossible to know for sure without seeing their source code, but I would bet that the Windows component acts as a server, listening for requests and sending responses. I doubt it's a server like an HTTP server; it's probably just using TCP/IP sockets with a custom protocol.
It probably sent a UDP message to the IP broadcast address. The PC program would be listening for that broadcast message and respond with "here i am, on this IP address". By using the broadcast address, the app doesn't have to do anything as complex as a network scan.
See this link: Broadcast Address - Wikipedia
It's more likely that the Android device does that when the app starts.
Again, without seeing their source code you can't be 100% sure, but given how these types of programs are written, these are the most likely answers.