Contact

admin

About Me · Send mail to the author(s) E-mail · Twitter

At GROSSWEBER we practice what we preach. We offer trainings for modern software technologies like Behavior Driven Development, Clean Code and Git. Our staff is fluent in a variety of languages, including English.

Feed Icon

Tags

Open Source Projects

Archives

Blogs of friends

Now playing [?]

Error retrieving information from external service.
Audioscrobbler/Last.fm

ClustrMap

RDP/Terminal Services Port Configurator for Windows Mobile

Posted in Mobility | Tools and Software at Thursday, August 10, 2006 9:11 PM W. Europe Daylight Time

Remote DesktopWindows Mobile devices come with an integrated Terminal Services client (also known as Remote Desktop Protocol, RDP). This client allows you to connect to any Remote Desktop-enabled machine like Windows XP Professional, Windows Server and Linux (another here). Actually a tempting idea to connect to your home machine if you're abroad. You just need a some kind of internet connection.

The Network

If there are multiple machines in a firewalled network the only public IP address known on the internet is the one of the router. The default server port for RDP connections is port 3389 (TCP protocol). RDP clients use this port when connecting to a RDP server. What happens if an internet user (RDP client) connects to port 3389 on the public IP of the router? If the firewall is set up correctly, nothing, i.e. the connection is refused. To enable Remote Desktop connections the network administrator has to configure a port mapping. The port mapping basically tells the firewall to open a specific port and route all data from this port to a specific machine on the internal network (for example your Windows XP box). If two users want to expose their machines to the internet the administrator has to open two ports, because a single port is always attached to a single internal machine. See the illustration below for a general overview.

Port Mappings

The Failure of the Windows Mobile RDP Client

To connect to the first machine ("Your Computer") from the internet the user has to tell its RDP client to simply connect to the firewall (because it's the machine with the public IP address). Because 3389 is the default port this actually translates to ServerName:3389, where ":" delimits the server name from the port number. To connect to "Another Computer" the address is ServerName:3390.

This is where the RDP client of Windows Mobile fails. It just won't accept servers with appended port numbers.

RDP Invalid Server Name

The First Approach

It's actually possible to change the behavior of the Remote Desktop client to connect to non-standard ports like 3390 or any other by applying a registry hack.

  1. Open the device registry using a registry editor
  2. Open the key HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default\
  3. Create an entry of type DWORD, called Server Port
  4. Set the value to the required port number (3390 in the case above)

My Solution

It's actually a very cumbersome task to edit the registry, especially if you're changing port numbers fairly often because you need to connect to different machines. After proof-reading Torsten's book on Windows Mobile development I thought this would be an easy to automate task.

I've written a little helper application that sets the registry values for you. I've tested it on my Axim x51v and inside the emulators of Visual Studio 2005. It's a .NET Compact Framework 1.0 application so you most likely don't have to install the .NET runtime on Windows Mobile 5.0 devices.

RDP Port Switcher

DownloadDownload the RDP Port Switcher Setup CAB. Feel free to add your own functionality, source code is available.

Now playing: Big Bud - Late Night Blues - State of mind

Friday, March 30, 2007 11:12:31 AM (W. Europe Daylight Time, UTC+02:00)
Brilliant!
Friday, March 30, 2007 7:48:08 PM (W. Europe Daylight Time, UTC+02:00)
You're welcome!
Friday, July 20, 2007 1:37:26 AM (W. Europe Daylight Time, UTC+02:00)
Thank you Alexander its beautifully perfect and exactly what i needed.
Your explanation is perfect!!!
Maish Lapidus
Tuesday, November 13, 2007 8:21:15 PM (W. Europe Standard Time, UTC+01:00)
Great, thanks. I was thinking how stupid microsoft canbe without providing an option to specify a different port. I almost gave up until I came across your site.
Paul A
Wednesday, November 28, 2007 11:43:14 PM (W. Europe Standard Time, UTC+01:00)
Excellent. Nicely explained!
paul desjardins
Sunday, April 20, 2008 1:03:45 AM (W. Europe Daylight Time, UTC+02:00)
Quick question - do you know how I can get RDP on my new WinMobile 6.0 Standard phone? I am running a locked Samsung Blackjack II. I can install apps fine but I cannot get the GPS to work with third-party software, etc.
Sunday, April 20, 2008 3:10:21 AM (W. Europe Daylight Time, UTC+02:00)
I'm sorry but I don't own a WM device anymore, much less your locked Samsung. As I can see you're asking two questions (RDP and GPS). Because of the lack of hardware I'm not able to answer these.
Tuesday, June 10, 2008 6:38:08 PM (W. Europe Daylight Time, UTC+02:00)
Fantastic... the only reason I even needed a Reg editor in the first place!
Tim
Thursday, August 28, 2008 6:48:17 AM (W. Europe Daylight Time, UTC+02:00)
Awsome!!
Damian
Wednesday, December 10, 2008 4:59:03 PM (W. Europe Standard Time, UTC+01:00)
BRAVO. Muchas gracias
Luis
Friday, October 16, 2009 5:25:24 AM (W. Europe Daylight Time, UTC+02:00)
I just got a new Verizon phone with Windows Mobile 6.5 - and the RDP client in this build allows an alternative port. (Using a colon, as expected).
Ben
Saturday, November 07, 2009 8:11:46 PM (W. Europe Standard Time, UTC+01:00)
Ben, where is RDP client in Windows Mobile 6.5? I have Samsung Omnia II and couldn't find this.
JaT
All comments require the approval of the site owner before being displayed.
(will show your gravatar icon)
 
[Captcha]Enter the code shown (prevents robots):

Live Comment Preview