0

I have a situation where I would like to communicate between 2-4 devices over the 3G network (it should also work over WLAN, but 3G solution is critical).

Every device (except one) asks for a GPS-location every ~5 seconds, but when this process is cancelled by the user of that device, one device needs to be informed of this event.

I was thinking that one device could act as a server, and the rest as clients that should connect to the server. Is this possible over the 3G network?

I've also read about push-notifications, is this relevant here? Can you receive notifications without disturbing the user with a popups etc?

Are there other ways?

Basically I would like to use apple "standard" solutions (if there are any) before diving into eventual socket-programming or anything similar...

What I would like to avoid is to have a webserver or some similar "3rd-party" solution, because I don't want many users to simultaniously connect and "pull" from the same external server in a final solution...

UPDATE:

Basically my application will have thousands of users that will need to be informed if an even occurs. Also this happens simultanously ~5 second, what would be the best solution to reduce load and avoid spamming?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
hirre
  • 19
  • 6

4 Answers4

1

I was thinking that one device could act as a server, and the rest as clients that should connect to the server. Is this possible over the 3G network?

It could work, but having a dedicated server would be a better choice

I've also read about push-notifications, is this relevant here? Can you receive notifications without disturbing the user with a popups etc?

In your case no, since you will need a server to communicate with apple

Basically I would like to use apple "standard" solutions (if there are any) before diving into eventual socket-programming or anything similar...

There are no standard solution, other than you should probably rethink about using a dedicated remote server for this

Omar Abdelhafith
  • 21,163
  • 5
  • 52
  • 56
  • I have a webserver and from there the users can post their external IP in order to find and later be able to communicate with each other. But I don't want the rest of the communication to go through a central 3rd-party point. It is okey if one of the devices acts as a server, but not a 3rd-party dedicated server because I want to reduce load... – hirre Jun 28 '12 at 08:58
0

iPhones can't communicate directly with each other using 3G. You can access the internet through the 3G, but you can't do peer-to-peer as you are suggesting. If you were close enough, you could use bluetooth, but I expect you are too far away.

You would have no way of detecting the one device that acts as a server from the other devices. The IP address could (and probably would) change every time the device connects to a mobile data network. You would need a central server to co-ordinate all of the clients.

Nick Bull
  • 4,276
  • 1
  • 18
  • 25
  • I have a webserver and the devices register themselves when they use my service (therefore they can register their external IP each time the they log in). But you are saying that they can't communicate directly with each other over 3G in general or because they normally can't find eachother? – hirre Jun 28 '12 at 09:03
  • Due to the nature of 3G communication, your device could drop connection and get a different IP address at any time when it switches cell, for example. – Nick Bull Jun 28 '12 at 09:17
  • Can the programmer check for that and manage it (e.g. re-register etc)? – hirre Jun 28 '12 at 09:24
  • How does e.g. apps like RunKeeper etc work, where a user can report their position live, and another user can read the position live as well. Let's say they have thousands of users and they each read/write at the same time... Not to forget r/w to e.g. a mysql db table at the bottom level... – hirre Jun 28 '12 at 09:28
0

You have multiple questions, but I'll try to address as many of them as I can:

I was thinking that one device could act as a server, and the rest as clients that should connect to the server. Is this possible over the 3G network?

No, you cannot run a server on a iPhone/iPad that is accessible over 3G without an external website acting as an intermediary. (You can run one that is accessible over Wi-Fi, but this does not solve your problem as stated.)

I've also read about push-notifications, is this relevant here? Can you receive notifications without disturbing the user with a popups etc?

Push requires you (or a third party contracted by you) to have a web server, so if you want a server-free solution it is not relevant here.

Are there other ways?

Over 3G you will, under the current Apple restrictions, always need an external server.

Basically I would like to use apple "standard" solutions (if there are any) before diving into eventual socket-programming or anything similar...

Diving won't help you here. Even using low-level socket programming you will not be able to run a server on an iPhone accessible over 3G without an external website to aid in establishing a connection.

idz
  • 12,825
  • 1
  • 29
  • 40
  • Basically my application will have thousands of users that will need to be informed if an even occurs. Also this happens simultanously ~5 second, what would be the best solution to reduce load? – hirre Jun 28 '12 at 09:12
  • @hirre Sorry, the answer to this is outside my sphere of expertise. This is more in the web app/content distribution realm. You might consider posting another question addressing this issue. – idz Jun 28 '12 at 09:15
0

You can try using GameCenter. The mechanism of network games in Game Center allows connect up to four players with no third-party solutions.