Click here to Skip to main content
15,866,422 members
Articles / Mobile Apps

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 236.4K   5K   105   32
This article lays down the basic groundwork for creating desktop application remote controls with the .NET Compact Framework.

Sample Image - pocketremote.jpg

Introduction

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.

Background

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.

License

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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Amir Mehrabi-Jorshari25-Oct-10 10:45
Amir Mehrabi-Jorshari25-Oct-10 10:45 
GeneralI need some help Pin
Member 129915913-Jun-09 12:55
Member 129915913-Jun-09 12:55 
GeneralRDCCLientHostLib type 1.0 Pin
sas21219-Sep-06 1:07
sas21219-Sep-06 1:07 
GeneralRemote Control App. Pin
xronox30-Aug-06 7:25
xronox30-Aug-06 7:25 
GeneralHi..How to send an image to a client system using NetworkStream [modified] Pin
Sabash28-Aug-06 18:19
Sabash28-Aug-06 18:19 
QuestionI need to make a Deskbar in VB.NET Pin
jordan_kaufman28-Aug-06 8:13
jordan_kaufman28-Aug-06 8:13 
QuestionThe same but using pictures instead of text ??? Pin
lvence16-Jul-06 12:09
lvence16-Jul-06 12:09 
AnswerRe: The same but using pictures instead of text ??? Pin
CCosgrove27-Jul-06 9:13
CCosgrove27-Jul-06 9:13 
GeneralTHANKS Pin
lvence16-Jul-06 5:18
lvence16-Jul-06 5:18 
GeneralHi. Pin
Kimmen17-May-06 23:02
Kimmen17-May-06 23:02 
I had some problems with connecting a pocket pc with a java server through WiFi, but thanks to your article we solved the problem! Thanks!
Generalhelllllllllppppp pleeeeaaaasssseee!!! Pin
beng_0627-Mar-06 3:21
beng_0627-Mar-06 3:21 
QuestionTimer stops...please help!!! Pin
gulars28-Jan-06 23:10
gulars28-Jan-06 23:10 
GeneralError Running Server Program Pin
manish111116-Sep-05 0:46
manish111116-Sep-05 0:46 
Generalcompact framework in windows CE Pin
hussain_ahmad_khan4-Aug-05 22:26
hussain_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
letonito11-Jan-05 14:45 
QuestionIs there more documentation? Pin
PaulJ10-Dec-04 10:02
PaulJ10-Dec-04 10:02 
GeneralRemote control of the Mobile device from the Desktop Pin
Alex Evans5-May-04 14:24
Alex Evans5-May-04 14:24 
QuestionWhich PDA? Pin
angus_grant27-Apr-04 17:11
angus_grant27-Apr-04 17:11 
AnswerRe: Which PDA? Pin
0NULL17-Dec-05 5:09
0NULL17-Dec-05 5:09 
GeneralThanks Pin
micro-com.net3-Mar-04 5:02
micro-com.net3-Mar-04 5:02 
GeneralHELP!!! Pin
nicosoft231-Mar-04 5:03
nicosoft231-Mar-04 5:03 
GeneralRe: HELP!!! Pin
angus_grant23-Sep-04 14:35
angus_grant23-Sep-04 14:35 
GeneralFull Duplex Pin
John H Long24-Feb-04 9:52
John H Long24-Feb-04 9:52 
GeneralDB Synchronization Pin
Mahesh Varma23-Feb-04 19:59
Mahesh 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.