Click here to Skip to main content
13,002,163 members (78,143 online)
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 14 Mar 2006

My First Remoting Experience

, 14 Mar 2006
Rate this:
Please Sign up or sign in to vote.
A really simple example on how to use remoting correctly in many ways
Sample Image - Remoting_for_Dummies.jpg


I decided to post this article because I never found what I was looking for on the Web. What I needed was an application that could "understand" what another application was saying. I'd found tons of examples of remoting and the simple Hello World! example, and of course the one where you can see the creation of an instance on the server for one of the object's attributes on the client. But that was not what I needed. I wanted to create an object, set its attributes and send it over the network to a different application which was programmed to do something with that object.

As Muhammad Musa Ali suggested, I'll explain a little bit more about remoting in case you have no clue what it is good for. Let's say you're building an IM app. You have to communicate with others through the network (for a start, let's just talk about a LAN). With the .NET technologies, you could open a TcpClient connection and use a NetworkStream in order to send strings over the network. You could "create" your own SOAP protocol in order to send more than one information to the other client as to who is sending the message, at what time the message was sent and so on. But if you could send an object of your domain, what if you could have a Message class with attributes as ID, text, time, and client, where client is an instance of a class also from your domain with attributes such as name, IP, address, state, etc. Well, that's what remoting is for.


I believe that if you're reading this, you are familiar with remoting and serialization, and you want an example of it. If that's not your case, I'd recommend you to read a little bit about them and then run the code.

Using the Code

This solution is really simple, it has three projects in it (Client, DLL and Server). The DLL project has an interface (ILogic) and a class (Client). This Client class is the one I will create on one application, set its attributes and send it over the network to a different app (Server). The ILogic is an interface implemented by the server in the Logic class. The three methods exposed by the interface are the ones the client app sees. The Client app has a simple form from which you execute methods from the server and one of them has a client object as a parameter.

So, to get it running, just right click on the Server project and under the Debug item click on Start new instance. After that, do the same as many times as you wish with the client project. When the client form appears, click the "Mensaje" button and take a look at the console. After that, just play around with the other buttons and messages.

Take a look at the "Hora" button and what you see on the console. Compare the two, amazing isn't it?

Bottom Line

It is really easy to use remoting and if you are in a controlled and closed environment, remoting is the right tool for you. But keep in mind that if you need to interact with some application outside your LAN, Web services would be the right tool for you. As you may have noticed, Web services are just a particular implementation of remoting.


  • 14th March, 2006: Initial post


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


About the Author

Software Developer
Uruguay Uruguay
Sebastian Gomez is a System Engineer in Uruguay, South America.
He's been working with .net technologies since beta 1.

You can reach Sebastian at: SebastianGomezCorrea[at]

You may also be interested in...

Comments and Discussions

Generalvery nice demo and example Pin
Muhammad Musa Ali14-Mar-06 11:09
memberMuhammad Musa Ali14-Mar-06 11:09 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170624.1 | Last Updated 14 Mar 2006
Article Copyright 2006 by sebagomez
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid