English 中文(简体)
国际太平洋共同体理事会在互联网4.0中的执行情况最简单?
原标题:Which IPC has the simplest implementation in .NET 4.0?

I have a multiple server client application in C# . My requirement is to exchange some float values between different clients.Which IPC mechanism is best & easy to use. I read shared memory is simplest but then it uses pointers which is considered as unsafe code in C#. Can you suggest me other mechanisms? Code examples will be very welcome .

问题回答

最好的办法是使用WCF命名的管道。 这里有一些主要程序。

  1. Define two interfaces, say, IServerActions and IClientActions IServerActions defines methods to be invoked by client applications; IClientActions defines methods for server to invoke individually or broadcast. IServerActions should include a Register method.
  2. Implement the two interfaces in client and server applications. The implementation classes could be the main form or any singleton class within the app.
  3. Client to server and server to client communications are similar, creating a named pipe channel and invoking methods. Client gets a unique ID (eg. Guid.NewGuid()) and registers on the server. Server maintains a list of client IDs and can create separate channels for broadcasting a message (sending the floating number in your case)

Here s a good example solution in .NET C#.
http://www.codeproject.com/Articles/7176/Inter-Process-Communication-in-NET-Using-Named-Pip





相关问题
posix_ipc python package equivalent for Windows?

Inter process communication primitives (Semaphores, Shared Memory) in python on windows? posix_ipc works great on linux, anything similar for windows?

passing events from erlang to Clojure

I m looking for a way to pass events back and forth between Clojure and erlang. has someone done this before? how should I encode the (immutable) messages in a flaxable general way? Should IPC be ...

Sockets vs named pipes for local IPC on Windows?

Are there any reasons for favoring named pipes over sockets for local IPC (both using win-api), effectiveness-wize, resource-wize or otherwise, since both behave very much alike (and likely to be ...

transparent process creation for cocoa components

I have an application A which may or may not need to spawn an application B and will communicate with it using remote messaging (via NSConnections etc.). While i know how to do this if B is started ...

Linux Pipes as Input and Output

I would like to do the following inside a C program on a Linux os: Create a PIPE using a syscall (or 2) Execute a new process using exec() Connect the process s STDIN to to the previously created ...

Shared memory vs. Go channel communication

One of Go s slogans is Do not communicate by sharing memory; instead, share memory by communicating. I am wondering whether Go allows two different Go-compiled binaries running on the same machine to ...

IPC between Python and C#

I want to pass data between a Python and a C# application in Windows (I want the channel to be bi-directional) In fact I wanna pass a struct containing data about a network packet that I ve captured ...

热门标签