Connecting your iPad/iPhone to AppleTV/Airplay over subnets

NOTE: THIS PROGRAM CONTINUES TO WORK WITH IOS7 BUT DOES NOT WITH THE NEW IOS8. AS APPLETV HAS AN OFFICIAL SOLUTION TO THE PROBLEM OF AIRPLAY OVER SUBNETS/VLANS WHEN USING IOS8, I WILL NOT BE UPDATING THIS PROGRAM TO WORK WITH IOS8.

 

The Problem

Airplay is brilliant. It lets you stream from your iPad or iPhone to an Apple TV or to your computer when using software like Airserver or Reflection. The problem is that it only works if your iPad or iPhone and the device you’re streaming to are on the same network. If you’re network is separated up into subnets/VLANs and the devices are on separate ones then it just won’t work.

One solution to this is a Bonjour gateway. But these have inherent problems – firstly for a home user with a simple, but sub netted, network it’s too complicated to set up. Secondly – for a large network such as a school, university, or business, these overwhelm the end user with device choices because each one is broadcast through.

The Solution

“Pairplay” is a program that tells an iPad or iPhone that an “Airplay capable device (e.g. an Apple TV) exists here”. regardless of sub netting, networks, and VLANs. Only the iPad or iPhone told about this device is aware of this information.

Licensing

Pairplay is free for home use (though feel free to Donate if you like it).

For business use the cost is £2 per machine license. For education and charities the cost is £1 per machine license. Licenses are per PC that you actually want to run the program on. The download is not crippled, you are free to test the program and get it working on your network before paying.

To pay please use the “Buy Now” link below. Paypal accepts all major credit cards. After choosing the price drop down and clicking the button you will be given the opportunity to set the quantity you need.


Option



Usage

Download Pairplay by clicking this link and install it.

Pairplay is a command line program. This is so that it can be added to network startup scripts as necessary. You will find it in a folder called Pairplay in either the Program Files folder or the Program Files (x86) folder on your hard drive.

You must initiate airplay by passing the following parameters:

Name – the name you would like your iPad or iPhone to show the apple TV as. It is best, although not essential, to make this a different name to the real AppleTV name. e.g. -Airplay    would make the iPad/iPhone show a device called “-Airplay”. I suggest the – sign in front because it generally sorts the name to the top of any list of devices; which is handy in a big network with many devices. (note: currently spaces are not accepted in the name)

Ipad IP Address – or iPhone ip address! This is the IP Address of the device you want to tell about the airplay service on the network. In small home networks this will nearly always be the same. In large networks it might be useful to statically assign IPs to your iPads or use reservations. On the iPad you can find your IP address by going to Settings->Wifi->and then clicking the “i” next to your connected wifi network.

Airplay IP Address – the IP address of the airplay device (AppleTV,Airserver,etc)  you would like to tell the iPad/iPhone about.

Hide – a true or false value which determines what happens to the console window when the program starts. If you are running this manually from the command line you should set this value to false. If you are running from a login script then you will want to set this value to true. A true value will hide the console window from the user.

Wait – a true or false value that indicates whether or not pairplay should wait for more than a couple of seconds if the airplay device doesn’t respond to it. Normally this would be false for an apple TV but true for a software solution.

Examples:

My iPad is on IP address 192.168.2.101 . I have an AppleTV on 192.168.2.100. I would like to tell my iPad that the it’s name should show as MyTV.

pairplay MyTV 192.168.2.101 192.168.2.100 false false

From a login script I would like to let the iPad on IP 192.168.2.101 know about the software airplay solution on 192.168.2.100. I would like to name it -LocalAirplay and hide the airplay program from showing.

pairplay -LocalAirplay 192.168.2.101 192.168.2.100 true true

That’s All You Need To Know. But for the curious….Here Comes The Science Bit

How airplay works…

An airplay device such as an AppleTV or their software equivalents (Airserver, Reflection, etc) announce themselves using a technology called mDNS. This is a local multicast technology. It cannot traverse subnets. UDP from device to device, of course, can.

When you initiate pairplay it first sends a UDP packet straight to the airplay device asking for information (note: it doesn’t use multicast so this is routable). The software equivalents will tend to send back data directly – i.e. not using multicast. So now airplay knows the necessary details about their airplay service. The apple TV either doesn’t reply or multicasts it or sets the TTL to 1 – I’ve not checked specifically but in any case there’s no routed response. So after a timeout period pairplay will assume that it is an apple TV and assume a default set of service details.

At this point pairplay knows the necessary details about the Airplay device. It makes a few tweaks to them – most notable it changes the name to the one you’ve specified.

It then sends this by UDP directly to the iPad/iPhone IP address your specified. By not multicasting this it is routable across subnets and means that only the device we intend to know about it knows about it (i.e. other ipads/iphones won’t add it to their airplay browse lists).

pairplay repeatedly tells your iPad/iPhone about the device, every 5 seconds, because iOS is prone to forget.

7 comments on “Connecting your iPad/iPhone to AppleTV/Airplay over subnets”

  1. Adam says:

    Is it possible to advertise to multiple devices, in our case iPads. I am using AirServer on a desktop PC and would like to advertise it to multiple iPads.

    1. Chris says:

      Hi Adam,

      That depends on how many multiple devices. If you have a small number then you can run the command several times. e.g.

      pairplay MyTV 192.168.2.101 192.168.2.100 false false
      pairplay MyTV 192.168.2.102 192.168.2.100 false false

      to serve iPads on 192.168.2.101 and 192.168.2.102 . Otherwise no (not currently at least), you’re in the territory of needing a Bonjour Gateway

  2. jon says:

    I want to confirm that your software will solve my issues. I have several apple tvs which reside on a subnet different from the iphones and ipads in the house and also different from the subent where the nas / server is located. I want the ipads to see the apple tv to airplay to them. I also want the apple tv to see the itunes on the computer so it can stream from itunes.
    I will only use one set for this example:
    Apple tv 192.168.2.100
    itunes computer 192.168.1.100
    iphone 192.168.1.130

    I want the apple tv to see the computer on the 192.168.1 network though it is on .2 and I also want it to work the other way around, where the computer on the .1 can see the apple tv on the .2.

    In the end these units must reside on different vlans but I the iphone to see the atv so we can stream music to them where they are conneted to AV systems to play music and I also want the apple tv units to stream from itunes on the computer – eventhough these items are all on different vlan/subnets. Please advise

  3. Gary Walker says:

    Will this not work on the IPad version 8 IOS? Ive just updated my device and my airplay no longer works using Reflector on my Windows 8.1 machine

  4. Stu says:

    Hey Chris,
    I love pairplay! I am really sad that you have decided not to update if for iOS8 due to the fact that I got a new phone and now cannot use pairplay at al. I’m a teacher and I used it at school a lot. In my district, we’re not allowed to use apple tvs, so your work around was so helpful. I know a lot of districts won’t use apple tvs, so to mirror an ipad screen, your program is it. Pairplay has so much application at the school/teaching level, I do hope you reconsider and update it for us teachers who want to use exciting technology in our classrooms.

    Thanks,
    Stu

    1. Chris says:

      Hi Stu,

      Thanks for the comment. It’s not very well advertised by apple but Teachers/Education/School Districts should keep in mind that there’s a feature in iOS8 which is really really beneficial when it comes to Apple TVs and educational use. It’s called peer to peer airplay. It means that with the latest software on an Apple TV and with iOS8 on an ipad/iphone then there is no need to connect an Apple TV to a school’s network in order to mirror to it! The Apple TV just needs to be plugged into the HDMI of a projector to work well in an educational environment. This provides a much more stable, reliable, and official solution. As the Apple TV is not network connected there’s not really any good reason for IT staff/districts to disallow it (it becomes a lot like plugging in, say, a DVD player.).

      There are some good arguments against software solutions such as Reflector/Airserver in a professional environment. Not least that each of them contains some, in my opinion, dubious hacked code/algorithms. It would take me quite some time to track down quite why pairplay is not working properly with iOS8 and it is likely the case that it is not fixable – so I decided to concentrate on other things and to encourage people towards the better official solution.

      Hope that explanation made sense.

  5. Stu says:

    Thanks! It made perfect sense! I’ll give the Apple TV a try!

Comments are closed.