Reputation: 28379
I'm trying to figure out what the solution is to having multiple android devices on one network share data.
Assuming all of them are running the same app, and a user "registers", I'd like to figure out (without any user input) what other devices on the network are available to be talked to and then to send them this registration data, so that when the user goes to the next device, their info is already there.
I'm able to ping the 255 connected devices in the x.x.x.0-255 range to see which respond, but am not clear on how I can write an app resident server (using the term loosely) that I could then send the data to.
I can't be the first person to need to solve this problem, but am unable to find anything useful on this front.
One caveat is that this is for devices that have no 3G (or other means) of getting to the internet, and the wifi network they're on won't have access to the internet either, so the solution has to be 100% internal network and can't include any additional devices (like a box running apache that all the device can use as a server).
TIA
Upvotes: 1
Views: 393
Reputation: 1007124
but am not clear on how I can write an app resident server (using the term loosely) that I could then send the data to.
Create a Service
that has code that opens a ServerSocket
and listens on incoming requests, such as an HTTP server.
On the whole, this is dangerous, but for constrained circumstances -- such as your "100% internal network" -- it should be safe.
Upvotes: 1