Click here to Skip to main content
Click here to Skip to main content

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

By , 31 Jan 2004
 

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)

About the Author

CJCraft.com
Web Developer
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralError Running Server Programmembermanish111116 Sep '05 - 0:46 
hi
when i run RemoteServer on my WindowsXp it gives an error like this
 
the application failed to initialize properly(0xc0000135).Click oK to terminate
I am using bluetooth to connect to the server.
Generalcompact framework in windows CEmemberhussain_ahmad_khan4 Aug '05 - 22:26 
i wanted to know really if anyone can tell me that what classes can i use to develop a web browser control in compact framework for windows CE.
like
 
tcpClient
tcpListener
httpWebResponse
httpWebREquest
 
husain
GeneralPDA as a remote control..susssjc230923 Jan '05 - 7:30 
Hi all
 
I'm looking to buy a PDA, hook it up to my wireless network with USB and use it like a "remote control" for a desktop pc.
 
Thought of buying a Belking or Hawking 54g Wireless USB device and connect to a HP iPAQ h1930.
 
Is that even possible?
 
The second issue is to control the desktop. I thought this might work by using a program like GoverLan, NetDirector or PC Anywhere to remotely control the desktop.
 
Could that work?
 
All comments much apreciated...
 
Thanks,
 
seb
 

 

Generalbluetooth questionmemberletonito11 Jan '05 - 14:45 
what do i need to change on the source code to make it work with bluetooth
 
i have an ipack pocketpc
 
what do i need for the server side??
 
antonio davila
QuestionIs there more documentation?memberPaulJ10 Dec '04 - 10:02 
Could you please complete the documentation. This is a great tool for me but I don't understand how it works so that I can expand on it. Hopefully you can complete this soon?
 
Paul Jahans
GeneralRemote control of the Mobile device from the DesktopmemberAlex Evans5 May '04 - 14:24 
Hello there
 
This is a nice trick, can be useful for all sorts of things, but what about controlling the mobile unnit from the Desktop... Kind of pc-Anywhere, for on the road support.
 
Hope someone can help here
 
Thanks
Alex
aevans@microknox.com.au
QuestionWhich PDA?memberminja27 Apr '04 - 17:11 
Hey everybody,
 
I'm new to pocket pc's. Any sites with evaluations, reviews, etc.
 
Angus
3 out of every 4 people make up 75% of the Worlds' population
AnswerRe: Which PDA?member0NULL17 Dec '05 - 5:09 
No sh*t
GeneralThanksmembermicro-com.net3 Mar '04 - 5:02 
Like all have said before me - great article!
There is a lack of information developing something worthwhile with the PDAs. Your article helps us to consider new things...
GeneralHELP!!!sussnicosoft1231 Mar '04 - 5:03 
When I try to open the source in .net 2003 I get an error
 
The application for project 'C:\test\RemoteServer.csproj' is not installed.
Make sure the application for the project type (.csproj) is installed.
 
I'm new to .net someone please help.......

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 1 Feb 2004
Article Copyright 2004 by CJCraft.com
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid