1

I want to start a little project, where I want to connect several of my devices. Some are Android mobile devices, others are desktop devices like a PC or laptop. Furthermore I want keep the project as generic as possible. Means I want to share it, so other people can use it.

By connecting I mean send messages between them. My problem is, that I'am not sure what technology or architecture to use, and hope to get some advice from you. (I think this question is more about software architecture then gorilla vs. shark)

I have considered several approaches already. I looked at Google's Cloud Messaging, but that seems not to fit my requirements, where several users can register to send independent messages. It looks more like, sending from one master to several devices.

The next thing I thought about was something lile VLC did with its Android remote app, where the desktop application hosts something like a server to which the mobile app must connect. This seems to be limited to LAN and only fits to about 80% of my use cases.

Is there another approach which does not require something like a server who is aware of all clients, which has to seperate the user's devices and route the messages?

1 Answer 1

1

You can use ZeroConf (a.k.a. Bonjour) to discover other devices on a local network and create an ad hoc network between them. If you want to be able to connect devices across larger networks, though, you're going to need a server with a fixed address so that all parties have some well-known address that they can connect to. Most devices (laptops, tablets, phones, etc.) don't have a fixed address, so they're often hard to find. Further, they're often behind firewalls which make them impossible to connect to even if you do know where to find them. Instead, each device needs to initiate the connection. Two devices obviously can't both initiate the same connection, but having them both connect to some server that relays messages between them solves the problem.

You also need to consider usability. You don't want to run background software that's constantly listening for connections on a mobile device simply because listening means that the WiFi radio has to be running, and keeping that radio running all the time is a quick way to kill your battery. You don't have that problem with a stationary server.

3
  • Do you have any experience, so you can recomend a server setup? I wanted to keep costs low, and therefore avoid purchasing a server.. Jan 20, 2013 at 20:51
  • You surely don't need to buy a server -- there are hundreds of options for Internet hosting. Some options are free for light use (Amazon's EC2, Google App Engine), most others are more traditional pay services. You can get more bandwidth than you probably need, unlimited disk space, e-mail accounts, popular content management systems, and all sorts of other features for $3 or $4 per month.
    – Caleb
    Jan 20, 2013 at 21:10
  • Thanks, for your hint about GAE. I looked into it, and it seems very promising. But I still didn't figured out how to notify the clients, of an event that occured in the server? I think for Android devices GCM comes to mind. But is it appropriate for a client like an Laptop or PC to pull with an 500ms rate? Jan 25, 2013 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.