Thursday, January 21, 2010

Streaming audio over 3G using Gmote on Android

The purpose of this post is to show how you can use Gmote to stream your music collection from anywhere, whether you're at a friends house, the gym, or in a car. Utilizing capabilities such as port forwarding, Dynamic DNS and URL Redirection, you can extend Gmote beyond just your home network and bring your entire music collection with you wherever you go!

Many people are already familiar with the Android app Gmote and its ability to control music and video on your computer from within your home network. If you're unfamiliar with Gmote, please have a look at the Gmote site for more information. I will not be covering how to install Gmote on your phone and computer. Therefore, if you're unfamiliar with this application, it would benefit you greatly to play around with it a little first before attempting to do what is being done here.

The image below shows an example of the configuration I'm going to create and use. When considering a typical home network environment, I believe most people can relate to the configuration below. As you can see, I have an internet router (internet gateway) which also acts as a firewall, and a computer which sits on my network and on which Gmote is running. In order to provide my Android phone with access to my music, I need to tweak my firewall settings to make this configuration work.

Image 1

First up, port forwarding. In a nutshell, port forwarding is going to allow Gmote on my phone, to move through the internet router/firewall and successfully connect to my PC running the Gmote service. By default, firewalls filter traffic. Without port forwarding, my firewall would drop the Gmote traffic.

Communications with Gmote work on either tcp port 8889 or udp port 9901. Gmote will use one or the other. I chose to forward tcp port 8889. Even with the overhead of tcp vs. udp, I've never had any buffering issues.

Using Image 2 below, you can see the Port Forwarding tab on my firewall. I have named the application field Gmote and input the port information of 8889 into the Port From field. This indicates to my firewall that it should listen for inbound traffic on tcp port 8889. The protocol is tcp and it's selected in the Protocol field. The IP address is the address of the computer on my network which is running Gmote. Finally, the Port to is the same port as the Port From field. The entire rule tells my firewall to listen for traffic on tcp port 8889 and forward it to my PC at 192.168.1.100 on tcp port 8889. This is exactly what is being done in Image 1.


Image 2

Now that port forwarding has been setup, I need to identify the external/outside IP address of my router. However, before we proceed any further, lets discuss briefly a common scenario which can be problematic when trying to setup remote access to your home network.

In the world of home internet access, many providers use some form of DHCP whereby your internet IP address will periodically change. If this is the case with your ISP as it is with mine, it can cause problems when you're trying locate your Gmote server from your phone. To overcome this challenge, we need to look at using Dynamic DNS and URL Redirection.

Dynamic DNS and URL Redirection service providers can either notify you when your IP address information changes, or better yet provide you with a domain name that will be automatically updated to point to the new IP address when a change occurs.

There are numerous companies out there which provide these types of capabilities. Using our example here, I chose no-ip. No-ip.com can be used for free and will map a dns name to my current router/firewall IP address. All that's required is the setup of a basic account, the download of a tool which runs on my PC at home, and the choice of an available hostname and domain name for which no-ip will map to your current IP address. Once the tool is running on your PC it will periodically check for an IP address change and update your hostname accordingly.

After you've created a hostname, launch Gmote on your Android phone. When the app has started, go to the Find Server option and enter your hostname information as shown in the image below. When your IP address changes, you don't need to manually update Gmote to find your music library!


Image 3

If everything is working correctly, you should be able to browse and play music from your phone. If you cannot get Gmote working correctly, check out a brief list of things below which may prevent access:

  • Windows firewall if enabled needs to allow tcp 8889
  • Any type of all-in-one security products which include a firewall may also need to allow tcp 8889
  • Ensure the IP address of your computer running Gmote has not changed from what you originally put in the port forwarding area of your firewall.
  • Ensure Gmote is running properly --can you access it from inside of your network?
  • Verify port tcp 8889 is open on Windows using the netstat command from a command prompt. I've filtered the output to what you're looking for below:


Happy listening!