Click here to Skip to main content
15,311,151 members
Articles / Mobile Apps
Posted 31 Jan 2004


105 bookmarked

Creating Desktop Application Remote Controls with the .NET Compact Framework (Part 1)

Rate me:
Please Sign up or sign in to vote.
4.65/5 (32 votes)
31 Jan 2004CPOL3 min read
This article lays down the basic groundwork for creating desktop application remote controls with the .NET Compact Framework.

Sample Image - pocketremote.jpg


The world of mobile computing is growing with each new day. Today the convergence of handheld devices with traditional desktop computing is just beginning to take off. There are limitless possibilities for extending desktop applications with handheld devices.

For example: consider a Pocket PC with an application remote control for PowerPoint. A presenter could take advantage of an existing 802.11 connection and control the presentation from anywhere in the room without having to hover over the presentation machine.

Another example would be an application remote control for Windows Media Player. This could be an add-on for Windows XP Media Center, or just the regular Windows Media Player. The user could select the next song to play on a connected home entertainment system from a play list of available songs on the network.

Of course, there are many other ideas like WinAmp remote controls, operating system remote controls (reboot, shutdown, or restart a machine remotely), and whole home automation systems. There are many possibilities for monitoring applications as well, where the handheld is more of a data pad for viewing remote state information.

This article is the first in a series that will discuss one possible method of creating application remote controls.


The proposed solution involves using the TcpClient class, which is available in the .NET Compact Framework and as well as in the full .NET Framework.

You might be asking why not use Web services? The only problem with Web services is the user will be required to host the Web service. This is usually found in enterprise solutions, but does not really work with the consumer market. Remoting services are not an option since the .NET Compact Framework does not support them.

While Remoting would be an ideal solution, especially if .NET Compact Framework supported serialization of objects and classes, the TcpClient has enough power to get the job done with minimal hassles.

One limitation that will make the task harder than it should be is the missing object and class serialization support. It would be cleaner to create a class that had all the necessary methods and properties that are needed for control the desktop application remotely.  TcpClient will allow two applications to read and write to a network stream. It is easier, therefore, to write command messages for the application remote control, similar to how an FTP client might send simple text commands over a socket connection.

In a future article, we will look how to improve the communications subsystem. Instead of simple text commands, we will consider custom class serialization to and from XML.

Most of the good implementation is in the source code. To be honest, it really is not complicated. There are some things that really make life easier for a desktop application remote control developer. One is having a wireless network and a handheld device that works on that network. 

Unfortunately, ActiveSync cannot be used since it will put the device on a different subnet from the rest of your network. This can make debugging a royal pain. Since you cannot perform Debug.WriteLine's on the .NET Compact Framework without creating custom listeners, it is a good idea to have a multi-line TextBox to send messages to while testing.

There are two parts to a desktop application remote control, a remote client running on a handheld device of some type, and a remote server running on a desktop machine of some type. In this example test PocketRemote, the handheld can send the server a message of the users choice. The server simply shows the message and sends a response back to the handheld device running the remote client application. The handheld takes the response from the remote server and shows it to the user on the handheld.

In the next few days, I hope to take a section at a time discussing and detailing how they work. I'd love to hear any feedback, questions, ideas, or suggestions regarding this article or any future articles.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author
Web Developer
United States United States
No Biography provided

Comments and Discussions

GeneralMy vote of 5 Pin
Amir Mehrabi-Jorshari25-Oct-10 10:45
MemberAmir Mehrabi-Jorshari25-Oct-10 10:45 
GeneralI need some help Pin
Member 129915913-Jun-09 12:55
MemberMember 129915913-Jun-09 12:55 
GeneralRDCCLientHostLib type 1.0 Pin
sas21219-Sep-06 1:07
Membersas21219-Sep-06 1:07 
GeneralRemote Control App. Pin
xronox30-Aug-06 7:25
Memberxronox30-Aug-06 7:25 
GeneralHi..How to send an image to a client system using NetworkStream [modified] Pin
Sabash28-Aug-06 18:19
MemberSabash28-Aug-06 18:19 
QuestionI need to make a Deskbar in VB.NET Pin
jordan_kaufman28-Aug-06 8:13
Memberjordan_kaufman28-Aug-06 8:13 
QuestionThe same but using pictures instead of text ??? Pin
lvence16-Jul-06 12:09
Memberlvence16-Jul-06 12:09 
AnswerRe: The same but using pictures instead of text ??? Pin
CCosgrove27-Jul-06 9:13
MemberCCosgrove27-Jul-06 9:13 
GeneralTHANKS Pin
lvence16-Jul-06 5:18
Memberlvence16-Jul-06 5:18 
GeneralHi. Pin
Kimmen17-May-06 23:02
MemberKimmen17-May-06 23:02 
Generalhelllllllllppppp pleeeeaaaasssseee!!! Pin
beng_0627-Mar-06 3:21
Memberbeng_0627-Mar-06 3:21 
QuestionTimer stops...please help!!! Pin
gulars28-Jan-06 23:10
Membergulars28-Jan-06 23:10 
GeneralError Running Server Program Pin
manish111116-Sep-05 0:46
Membermanish111116-Sep-05 0:46 
Generalcompact framework in windows CE Pin
hussain_ahmad_khan4-Aug-05 22:26
Memberhussain_ahmad_khan4-Aug-05 22:26 
GeneralPDA as a remote control.. Pin
sjc230923-Jan-05 7:30
susssjc230923-Jan-05 7:30 
Generalbluetooth question Pin
letonito11-Jan-05 14:45
Memberletonito11-Jan-05 14:45 
QuestionIs there more documentation? Pin
PaulJ10-Dec-04 10:02
MemberPaulJ10-Dec-04 10:02 
GeneralRemote control of the Mobile device from the Desktop Pin
Alex Evans5-May-04 14:24
MemberAlex Evans5-May-04 14:24 
QuestionWhich PDA? Pin
angus_grant27-Apr-04 17:11
Memberangus_grant27-Apr-04 17:11 
AnswerRe: Which PDA? Pin
0NULL17-Dec-05 5:09
Member0NULL17-Dec-05 5:09 
GeneralThanks Pin
micro-com.net3-Mar-04 5:02
Membermicro-com.net3-Mar-04 5:02 
GeneralHELP!!! Pin
nicosoft231-Mar-04 5:03
Membernicosoft231-Mar-04 5:03 
GeneralRe: HELP!!! Pin
angus_grant23-Sep-04 14:35
Memberangus_grant23-Sep-04 14:35 
GeneralFull Duplex Pin
John H Long24-Feb-04 9:52
MemberJohn H Long24-Feb-04 9:52 
GeneralDB Synchronization Pin
Mahesh Varma23-Feb-04 19:59
MemberMahesh Varma23-Feb-04 19:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.