Click Here to Install Silverlight*
IndiaChange|All Microsoft Sites
MSDN
|Developer Centers|Library|Downloads|How To Buy|Subscribers|My MSDN
 
Chat Transcript
 
Inter Process Communication in .NET
Host
: Kumar Gaurav Khanna, Microsoft MVP
July 18, 2003
 
Deepak_MS: Hi Good Evening friends!

Deepak_MS: Today we have with US Kumar Gaurav Khanna, who will talk about inter-process communication in .NET

Deepak_MS: So lets get started with your questions..

KGK: Good morning and Good evening

KGK: Incase there arent any questions, maybe I will tell a bit about

KGK: yes... well, IPC, or Interprocess Communication had its humble beginnings

KGK: from Clipboard and DDE, or the Dynamic Data Exchange

KGK: The idea was simple: in a given application, classes, functions etc can always get to access shared data. However, what if the same data needs to be shared with other applications, that might be part of the main application (like in a client-server architecture)

KGK: or they are not at all related to the main app.

KGK: However, while Clipboard went ahead and solved this issue to a very limited extent its primary limitation was the fact that it was restricted to sharing data on the same physcial machine.

KGK: So, an app running on a different machine will not be able to access Clipboard of another machine.

KGK: Also, DDE had its programming complexity which defeated the purpose a lot.

KGK: So, maturing with Win32, Windows soon had a better means of IPC

KGK: 1) Mailslots 2) Pipes (named and anonymous 3) Better WinSock for socket communication

KGK: These three IPC fundamentals were particularly present and strong in NT architecture from quite early beginnings..

KGK: 9X architetcure had limited support for the same - but as time went by... a new dev platform came up...what we now term as .NET

KGK: And this has brought in some even better IPC communication mechanisms:

KGK: 1) WebService (ASP.NET and Remoting based)

KGK: 2) Remoting

KGK: 3) Easier and better Socket support

KGK: 4) Clipboard, of-course, is still there

KGK: But does that mean that the previous technologies, like Pipes, were taken off?

KGK: No way there are alive and kicking.. especially since high end server products like SQL Server use them to communicate with their client parts and .NET, though natively doesnt support Pipes, Mailslots in its FCL implementation,it does support using them via interop.

KGK: So that rounds up our basics..

Deepak_MS: (ipcs): Will this .NET supports somthing called transport layer communication which all standard UNIX platforms supports?

KGK: When you talk about Transport layer you are talking about typical network communication, according to the OSI model

KGK: Yes, the TCP/IP stack is supported, and TCP/UDP protocols are supported

KGK: natively in the .NET FCL implementation from the perspective of Transport layer

KGK: Compact Framework, even supports talking with InfraRed devices using Sockets - at the application layer.

Deepak_MS: (ipc): What are the latest things that got added in .NET IPC apartt from the standard nes ipcs : is that asp.net (webserver) something like internet super server daemon in UNIX?

KGK: As I said... .NET has inherent support for TCP/UDP for IPv4 starting with .NET 1.1, they are also supported over IPv6

KGK: IrDA, via sockets is supprted,

KGK: and starting with Windows Server 2003, the kernel supports Bluetooth and interacting with such applications/devices using it.

KGK: Not natively, but via Interop, .NET apps can leverage that capability too!

KGK: ASP.NET is not a webserver.. IIS is. ASP.NET is simply a ISAPI plugin..

KGK: something like a server side CGI app, except that its not CGI and is more advanced and sophisticated.

Deepak_MS: (Anubhav): So whats the Application Domain in .net. its the same right? which uses the IPC?

KGK: Actually not... Application Domain is a basically a code execution environment

KGK: that is used to segregate different applications/codes that need to be executed.

KGK: The idea is that AppDomains will provide an execution isolation to the code running within them from the code, running in another AppDomain so that if the latter code crashes for some reason, code running in other AppDomains isn't affected.

KGK: From the perspective of IPC, AppDomains are boundaries that need to be surpassed

KGK: for data to be shared between codes executing in different AppDomains

KGK: for which WebServices, Remoting, sockets, etc can be used as IPC mechanisms.

Deepak_MS: (SriSamp): Assuming that IPC is an ingrained communication mechanism for applications, how do applications leverage it?? Are there any hooks that we can play with??

KGK: IPC is a generic inter-process communication mechanism

KGK: Sockets, Remoting, Pipes, etc are specific ones.

KGK: How do apps. leverage it? Take for instance SQL Server

KGK: When you use the SQL Server Enterprise manager, or the Query analyzer clients, they connect to the server, either using Named Pipes or TCP/IP Sockets to get access to the server's shared configuration and also to talk with the same to send queries and get the results.

KGK: Done.

Deepak_MS: (ipcs): What's the 4 bone and 6 bone architectures"...???

KGK: http://www.faqs.org/rfcs/rfc2546.html

Deepak_MS: (Kash): Can u tell something about object activation in Remoting?

KGK: Well, I am talking about Remoting as an IPc mechanism here but still..

KGK: Object activation basically determines how the object will be accessed, where it will reside, how TP/RP will come into play.

KGK: Typically, you will have a Server Activated Object (SAO), or a Client Activated Object (CAO)

KGK: Singlecall and Singleton are examples of SAO...while in the case Singleton, a single obect constructed in memory is used to service

KGK: all client requests, the Singlecall object is constructed and destructed after each method call.

KGK: Thats why, for IPC, or to share some global server data, Singleton is the way to go.

KGK: For details of remoting architecture, you may want to read this:

KGK: http://www.microsoft.com/indonesia/msdn/dotnetremotearch.asp

Deepak_MS: (Kash): and also about singleton and singlecall activation?

KGK: My explanation above talks about it.

Deepak_MS: (SriSamp): Any sample .NET code around which demonstrates how an application can create an IPC with another machine and then communicate some data across??

KGK: Loads of them any socket code for .NET is an example. Here's a treasure chest:

KGK: http://www.codeproject.com/csharp/#Internet

Deepak_MS: (ipcs): any nice books for .NET beginers and learning the architecture...

KGK: hmm.. C# and .NET Platform (APress)

KGK: For Architecture: Essential .NET: The Common Language Runtime by DonBox

KGK: Jeff. Richters "Applied .NET Framework Programming"

KGK: And finally, for Remoting: Ingo Rammer's "Inside .NET Remoting"

Deepak_MS: (Narayan): Hi, have u covered ,what's new features of IPC in dotnet?

KGK: yes I did... IPv6, IrdA, and Bluetooth with Server 2003 (though not in .NET FCL yet)

Deepak_MS: How does one decide whether to use .NET Remoting or Web Services?

KGK: That is a good question:

KGK: Do you want statelessness in ur components, wish to access them across firewalls and expect them to be used by non-.NET clients?

KGK: Use WebServices.

KGK: Do you wish to have secure component interaction, or faster communication?

KGK: Or have more scalable systems? Use Remoting

KGK: Finally, if you are looking for a replacement for RPC/DCOM in your Intranet for IPC between apps, use Remoting.

KGK: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconchoosingcommunicationoptionsinnet.asp

KGK: This links above exemplifies more ASP.NET WebServices vs Remoting decision issues.

Deepak_MS: (Deepak): Is DCOM still around in .NET?

KGK: Nope.. .NET, Remoting has replaced DCOM

KGK: For the primary reason that Remoting

KGK: is based upon more standard protocols, like TCP/HTTP

KGK: SOAP, etc

KGK: also, its architecture is pluggable enough to be replaced

KGK: So, if you wish, you can have your own custom transport, like SMTP

KGK: And the very fact its based upon open standard, allows it be routed

KGK: which wasn't with DCOM since it was based upon RPC which was non-routable.

Deepak_MS: (Kash): but what is the difference between system.Net and remoting?

KGK: System.Net namespace contains classes that are counterparts for WinSock based communication

KGK: they use Sockets for communication over the network.

KGK: Internally, remoting also uses sockets for its low-level network communication.

KGK: You can say, that, remoting is an implementation of IPC using sockets underneath.

KGK: Done.

Deepak_MS: (Kash): so which one is better?

KGK: both have its own areas of usage and cant be compared.

KGK: If you are wishing to talk, say, with a socket server, like an email server,

KGK: you would use Sockets. But if you wish to communicate with an object server

KGK: to remotely instantiate objects then you would use Remoting.

KGK: Since we are nearing the end of the chat, lets brief up on the IPC mechanisms, and when to use which one:

KGK: 1) To talk with legacy applications that are using traditional mechansims of IPC, like Mailslots, Pipes,

KGK: you will need to use the same, via interop. in .NET.

KGK: 2) WebServices are the best et when you want to ensure that IPC can occur across a firewall

KGK: and is available for even non.NET clients. But keep in mind that WebServices are stateless in nature

KGK: and hence, information will not be persisted across calls. So, they are good to set and fetch data

KGK: to/fro a shared storage, like DB, memory, etc

KGK: 3) Remoting is the way to go if you wish to have secure IPC between your applications within the Intranet

KGK: or wish to maintan state across method calls

KGK: or you wish to have IPC across Machine, AppDomain, Process boundaries

KGK: Of course, the point to be kept in mind is that Remoting is very particular to .NET so only .NET based applications will be able to utilize it.

KGK: This is unlike a typical webservice that can be consumed by any SOAP compliant client.

KGK: The idea is to identify the scenario at hand

KGK: and use the appropriate IPC mechanism.

KGK: So, that's about it, for IPC, for today.
     

©2009 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement
Microsoft