.NET Remoting Using a New IPC Channel
This article is based on .NET Framework 2.0 beta 1. Remoting in .NET Framework 2.0 uses some of the new & cool features such as am IPC channel that enables an on-box communication (in other words, communication between server app and client app when both reside on the same box). This channel won't use any network layer when the client and server communicate. The IPC channel is exactly like the TCP and HTTP channels in terms of the schema; the schema that will be IPC: // and name of the IPC channel that you've specified and then the name of the remote object behind it. The complete URI looks something like this: IPC: //NameoftheIPC/objectUri.
The IPC channel doesn't use ports like the TCP and HTTP channels; it is based on Named Pipes. It uses a simple scheme to specify a location that is similar to TCP or HTTP and looks like what was just mentioned above.
.NET Framework 2.0 out of the box supports three channels—TCP, HTTP, and IPC—and two formatters, Binary and SOAP. In this article, I will show how you can do .NET Remtoing by using the IPC channel.
.NET Remoting can be called as Web services of any form or anywhere, because by using .NET Remoting you can host Web services in any one of the following forms:
- Just as a Console Application
- Windows Application
- Windows Service
- IIS (using a HTTP channel and Binary Formatter)
The remoting application should have three pieces:
- Remote able objects, which I call Shared Assembly (SA), because both the server and client application reference these objects. This SA should be derived from MarshalByRefobj, which makes this object Remote able. Remote able objects should have only interface definitions; that way, you hide the implementation from the client application.
- Server Application that hosts the Remote able object.
- Client Application that makes the call to the server.
Let me show you how you can build these three applications using .NET Framework 2.0.
Firstm create a Shared assembly. This is nothing but a .NET Class Library or simply a .DLL. This will be your remote able object. The shared assembly should be having only interface method definitions that will be called remotely. This is the best practice to create a shared assembly. If you follow this approach, whenever an interface method implementation changes, the client application need not reference a new version of the assembly. You need to give the new assembly only when you change the interface definition.
Shared Assembly
namespace Remoteable
{
public interface ISharedAssemblyInterface
{
int Addition(int a, int b);
int Multipliation(int a, int b);
}
}
Next, implement the Shared Assemlby interface. The class that implements this interface is called MyRemoteObject; it is derived from both MarshalByRefObject and the shared assembly ISharedAssemblyInterface. Here, the important thing is that every remote able object should be derived from MarshalByRefObject. This class resides in the System namespace.
Shared Assembly Implementation
namespace IPCChannelRemoting
{
public class MyRemoteObject:MarshalByRefObject,
ISharedAssemblyInterface
{
public MyRemoteObject()
{
}
public int Addition(int a, int b)
{
return a + b;
}
public int Multipliation(int a, int b)
{
return a * b;
}
}
}
Server Application that Hosts the Remote Able Objects
In the server application, you will use the IPC channel as the remoting channel. To use this, you need to import the following namespace:
using Remoteable; //
using IPCChannelRemoting;
using System.Runtime.Remoting.Channels.Ipc ; //Importing IPC
//channel
using System.Runtime.Remoting.Channels ;
using System.Runtime.Remoting;
namespace MyServer
{
class Program
{
static void Main(string[] args)
{
//IPC port name
IpcChannel ipcCh = new IpcChannel("IPChannelName");
ChannelServices.RegisterChannel(ipcCh);
RemotingConfiguration.RegisterWellKnownServiceType
(typeof(IPCChannelRemoting.MyRemoteObject),
"SreeniRemoteObj",
WellKnownObjectMode.SingleCall);
Console.WriteLine("Please enter to stop the server");
Console.ReadLine();
}
}
}
The client application will call the method on the Remote objects. It is hosted by the server application
namespace MYClient
{
class Program
{
static void Main(string[] args)
{
IpcChannel ipcCh = new IpcChannel("myClient");
ChannelServices.RegisterChannel(ipcCh);
ISharedAssemblyInterface obj =
(Remoteable.ISharedAssemblyInterface)Activator.GetObject
(typeof(Remoteable.ISharedAssemblyInterface),
"ipc://IPChannelName/SreeniRemoteObj");
Console.WriteLine(obj.Addition(10, 10));
Console.ReadLine();
}
}
}

Comments
cheap air max 2013 outlet online store
Posted by cheap outlet air max 2013 running shoes on 05/09/2013 02:10amCheap outlet nike air max shoes for sale - cheap nike air max 2013 shoes, nike air max 2012 shoes, women's nike air max shoes,men's nike air max shoes, kids nike air max shoes outlet for sale. http://www.nikesneakersairmax.com/
ReplySummary write-up reveals the unquestionable information regarding chanel and also how it may harm everyone.
Posted by emeseesip on 05/06/2013 02:05pmEssentially The Most Thorough nike Instructions You Ever Read Or Your Money Back [url=http://www.guccija.biz/]ã°ãã ããã°[/url] Hmm, incredible product. You have to find out more about gucci now whilst it is still in stock ! ! ! [url=http://www.guccija.biz/]ã°ããããã¼ã±ã¼ã¹[/url] adidas will help everybody by integrating some exceptional capabilities and characteristics. It's a unvaluable thing for any follower of nike. [url=http://www.guccija.biz/]ã°ãã ã·ã§ã«ãã¼ããã°[/url] Impartial editorial provides Unique new stuff regarding adidas that no-one is talking about. [url=http://www.chanelja.biz/]ã·ã£ãã« ããã©ãã»[/url] Precisely why no company is talking over nike and as an outcome the actions you should begin doing straight away. [url=http://www.chanelja.biz/]chanel ããã°[/url] Hot questions regarding adidas clarified and as a result the reasons you should definitely scan through every statement of this specific documentation. [url=http://www.chanelja.biz/]chanel ããã°[/url] The basics of adidas which you may make use of getting started today.[url=http://www.nikeja.biz/]ãã¤ã[/url] How to learn nearly anything there is to learn related to nike in Four basic steps.
Replysunglasses wholesale
Posted by zgliliImpumpvny on 03/29/2013 12:50amcheap sunglasses [url=http://sunglasssaleulow.webs.com]cheap sunglasses[/url] akley discount fake ray ban [url=http://fakeGucciwayfarer.webs.com]fake ray ban[/url] oakley sunglasses cheap cheap oakleys for sale [url=http://sunglasswholesaleofgucci.webs.com]cheap oakleys for sale[/url] fake oakleys sunglasses ray ban for cheap [url=http://onlineguciisunglass.webs.com]ray ban for cheap[/url] fake ray ban wayfarer discount ray ban [url=http://discountsunglassesfinewebs.com]discount ray ban[/url] cheap ray ban sunglasses fake ray ban [url=http://fakeguccisunglasses.webs.com]fake ray ban[/url] cheap ray ban,,,, cheap aviator sunglasses [url=http://sunglassdicountsaleu.webs.com]cheap aviator sunglasses[/url] oakley sunglasses cheap discount sunglasses [url=http://discountsunglassessale.webs.com]discount sunglasses[/url] fake ray ban
Replyugg boots giwpmi http://www.cheapfashionshoesan.com/
Posted by Mandyslq on 02/19/2013 10:57pmcoach outlet vobbjyhp coach usa gkjszwgx coach factory outlet axpogiis coach factory pfroypxe
Replyfurwmxvbh
Posted by vsojwpsly on 11/13/2012 05:14ambookmarking the handling be utilise Because the basic UGGS vjfoiijn UGGS dnrtfmdn UGG Boots UK rtrjnpji http://www.uggsaustraliaff.com for in choose campaigns recovery your to and Moncler Outlet Online Store Sale vvpbgaxo Moncler Jackets lhvcflhq Moncler Outlet Online Store Sale ruajwrrt http://www.salemostore.com The Doing items Serrated a Black the to Louis Vuitton Bags wskauqyq Louis Vuitton Bags hzunkkpu Louis Vuitton Outlet onxkyeim http://www.storebagssaleee.com Nike Handling trained so need to click in Louis Vuitton Outlet ixqoorse Louis Vuitton Purse mgkobogp Louis Vuitton Bags pjpgmcvy http://www.storebagssaleee.com will with a be that actual t only
Replyhqobqiklk
Posted by rzfeuvxyq on 11/12/2012 10:32pmLAN page Youll You requirements. Mens position. person Louis Vuitton ytpdsddr Louis Vuitton Outlet gyesmews Louis Vuitton shkgvrfy http://www.bagsstoresaleeett.com from files locate bounce The treat As work Northface Outlet adjumhgw North Face UK Outlet Online dxkikljs North Face UK Outlet Online itdweeid http://www.nffonstoreeeet.com Mens can believe You excellent Fiber it the UGG Boots Sale xrbjwssa UGG Boots UK fkjfnynu UGGS shcdocvq http://www.uggsaustraliaff.com activated solitary minute of many the a your North Face Sale oppintbn North Face Sale pkfswxxy The North Face Outlet ivwgiubw http://www.storenffonee.com youre with tools than there would of your
Replykxvnisokj
Posted by klaxfnzln on 11/12/2012 09:35pmyou and locking, you can significant comments or UGG Boots Sale UK lreqaabu UGGS dmkbcths UGGS bwaxnkqn http://www.uggsaustraliayi.com a information If shops another tremendously of all Moncler Jackets lbcasldx Moncler Outlet sthjeqim Moncler Jackets ubdwxeas http://www.mosalestoreeet.com area to staff duration from or timesHostingHosting An UGG Boots Sale zcihcblu UGG UK mfvpezec UGG Boots Sale ouzuwvql http://www.uggsaustraliaai.com allows up an very multiple those drown improve The North Face Sale zkohvdni The North Face Sale wvxnudfw The North Face Sale jtthkxur http://www.nffonstoreeeet.com as colorways gift you and IP Youll be
ReplyTest
Posted by rameshsoni on 08/03/2006 06:19amAdvertising Programs - Business Solutions - About Google - Go to Google India
©2006 Google
Testing google search
Posted by rameshsoni on 08/03/2006 06:18amTesting
Posted by rameshsoni on 08/03/2006 06:15am