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


Open Source Projects


Blogs of friends

Now playing [?]

Error retrieving information from external service.

RDP/Terminal Services Port Configurator for Windows Mobile

Posted in Mobility | Tools and Software at Thursday, 10 August 2006 21:11 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, 30 March 2007 11:12:31 (W. Europe Daylight Time, UTC+02:00)
Friday, 30 March 2007 19:48:08 (W. Europe Daylight Time, UTC+02:00)
You're welcome!
Friday, 20 July 2007 01:37:26 (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, 13 November 2007 20:21:15 (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, 28 November 2007 23:43:14 (W. Europe Standard Time, UTC+01:00)
Excellent. Nicely explained!
paul desjardins
Sunday, 20 April 2008 01:03:45 (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, 20 April 2008 03:10:21 (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, 10 June 2008 18:38:08 (W. Europe Daylight Time, UTC+02:00)
Fantastic... the only reason I even needed a Reg editor in the first place!
Thursday, 28 August 2008 06:48:17 (W. Europe Daylight Time, UTC+02:00)
Wednesday, 10 December 2008 16:59:03 (W. Europe Standard Time, UTC+01:00)
BRAVO. Muchas gracias
Friday, 16 October 2009 05:25:24 (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).
Saturday, 07 November 2009 20:11:46 (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.
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