采用管道进行通讯的例子
作者:肖波
用Remoting做进程间通讯,效率较低,于是做了一个采用管道技术进行进程间通讯的例子,在1.8G 双核计算机上每秒钟可以发送180M数据。下面给出源码
Server端的管道类
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using Pipe.Win32;

namespace Pipe.Server
Client 端的管道类
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Pipe.Win32;

namespace Pipe.Client
NTKernel.cs
这个程序文件Client 和 Server 都要,封装了相应的API函数
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;


namespace Pipe.Win32
客户端调用
byte[] buf = new byte[10240];
Pipe.Client.PipeClient client = new Pipe.Client.PipeClient("test", 102400);

for (int i = 0; i < 10000; i++)
}
服务器调用
static bool begin = true;
static System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
static int count = 0;
static object lockObj = new object();

static void ReceiveMessage(System.IO.MemoryStream m)
}
源码下载位置
用Remoting做进程间通讯,效率较低,于是做了一个采用管道技术进行进程间通讯的例子,在1.8G 双核计算机上每秒钟可以发送180M数据。下面给出源码
Server端的管道类
Client 端的管道类
NTKernel.cs
这个程序文件Client 和 Server 都要,封装了相应的API函数
客户端调用
服务器调用
源码下载位置