Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Is it possible to communicate between apps via localhost?

Tags:

networking

ios

Consider this hypothetical situation:

Bob and Eve's apps are installed on the same iPhone. Bob's app is running and binds to localhost:8080 to listen for AJAX calls from its own UIWebView. Eve's app runs in the background and tries to interfere with Bob's app by making AJAX calls to localhost:8080.

Two questions:

  1. Assuming Eve's app knows Bob's AJAX API, will her calls be successful? (i.e. does iOS sandbox traffic on localhost?)

  2. Is it possible for Eve's app to sniff the traffic Bob's app is generating?

like image 367
Ryan J. Thompson Avatar asked Dec 05 '12 23:12

Ryan J. Thompson


People also ask

Can I run localhost on iPhone?

Accessing localhost from the iPhone will simply do a loopback / try to connect to itself (If it supports that?). What you need to do is find the IP of your desktop machine (e.g. If Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status .

How does iOS App communicate with server?

At the basic level, the iphone communicates over the internet. The internet uses Internet Protocol, and there are two standard protocols built atop of IP: Transmission Control Protocol, and User Datagram Protocol. Each has it's own uses and functions. TCP/IP and UDP/IP make up the backbone of internet communication.

Can iOS Apps communicate with each other?

Share All sharing options for: iOS 8 apps can talk to each other. Apple is adding one of the most-requested features to iOS 8: inter-app communication.

How do I deliver iOS app to client?

Log in with your Apple ID (your account for iTunes) and enter in your name, recipient's name, and recipient's email. You'll get a chance to review the app gift before buying it. Once you do, your account will be charged, the app will be sent to your gift recipient, and you'll get a receipt.


1 Answers

  1. if Bob's app is running, yes Eve's app can connect to it.

There are 2 possible ways to have this happen. Either Bob's app is in the foreground, and Eve's app connect to it in the background, given that Eve's app is running in background. Or, Bob's app is running in the background, and Eve's app connect to it in foreground.

By default the iOS suspend apps in background. If the app make use of background execution, and continue to run in the background, it can access the network as usual.

You may want to read "Beyond The Basics" in Apple's technical notes on Networking and Multitasking

  1. Sniffing traffic require root access, it cannot be done unless Eve's app is a jailbroken app.

In the section "BSD (including Mac OS X)" of the article Wireshark CapturePrivileges, it state that on BSD systems we need to have permission to access BPF devices to capture packets (read: sniff network traffic). Only root (or any superuser) can access the BPF devices, or grant permission to any other user to access them.

like image 120
howanghk Avatar answered Oct 11 '22 22:10

howanghk