this.m_Pipe = new NamedPipeClientStream(".", _PipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
lastPipeStream = new NamedPipeServerStream(_PipeName, PipeDirection.InOut, maxNumberOfServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
这两个怎么没有你所说的那些
lastPipeStream = new NamedPipeServerStream(_PipeName, PipeDirection.InOut, maxNumberOfServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
这两个怎么没有你所说的那些
解决方案 »
- 如何实现右键点击tabcontrol中的tabpage,就弹出下拉菜单呢??
- 请问如何用反射创建结构体的实例
- 【热帖100分】短信猫
- 送分了,懂.NET的快来领分 【“尝试读取或写入受保护的内存错误”的问题】
- ASP能和c#可执行程序通信吗
- 如何固定网页的大小
- 比如租个服务器,上传一个b/s程序,然后推销这个软件(如摩托车进销存),只要交钱就给他一个密码,这样行得通吗?有人这样做过吗? (
- 再次提问同样的问题。SendMessage的问题。这回应该表达的很清楚了。
- 求Borland Together For VS .NET 1.0的正式版或注册码、注册机之类的
- 求助,关于获取解析网易云音乐网页源码问题,脚本加载完后的....
- 请问为什么winform的listbox有2000行数据时,添加数据很快,而用removeat删除效率却很低下呢?
- byte[] 数据如何存入数据库,程序编译通过,但运行报错
嗯?请问你说的是什么?我自己倒入了一个NamedPipeNative的库,这个是在vc中封装好了的。using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace NamedPipeLib
{ public static class NamedPipeNative
{
public const uint PIPE_ACCESS_DUPLEX = 0x00000003; public const uint PIPE_READMODE_MESSAGE = 0x00000002; public const uint PIPE_TYPE_MESSAGE = 0x00000004; public const uint PIPE_WAIT = 0x00000000; public const uint PIPE_UNLIMITED_INSTANCES = 255; public const int INVALID_HANDLE_VALUE = -1; public const ulong ERROR_PIPE_CONNECTED = 535; public const uint GENERIC_WRITE = (0x40000000); public const uint GENERIC_READ = (0x80000000); public const uint OPEN_EXISTING = 3; public const ulong ERROR_PIPE_BUSY = 231; [DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr CreateFile(
String lpFileName, // file name
uint dwDesiredAccess, // access mode
uint dwShareMode, // share mode
SecurityAttributes attr, // SD
uint dwCreationDisposition, // how to create
uint dwFlagsAndAttributes, // file attributes
uint hTemplateFile); [DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr CreateNamedPipe(
String lpName, // pipe name
uint dwOpenMode, // pipe open mode
uint dwPipeMode, // pipe-specific modes
uint nMaxInstances, // maximum number of instances
uint nOutBufferSize, // output buffer size
uint nInBufferSize, // input buffer size
uint nDefaultTimeOut, // time-out interval
IntPtr pipeSecurityDescriptor // SD
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool ConnectNamedPipe(
IntPtr hHandle, // handle to named pipe
Overlapped lpOverlapped // overlapped structure
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool ReadFile(
IntPtr hHandle, // handle to file
byte[] lpBuffer, // data buffer
uint nNumberOfBytesToRead, // number of bytes to read
byte[] lpNumberOfBytesRead, // number of bytes read
uint lpOverlapped // overlapped buffer
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteFile(
IntPtr hHandle, // handle to file
byte[] lpBuffer, // data buffer
uint nNumberOfBytesToWrite, // number of bytes to write
byte[] lpNumberOfBytesWritten, // number of bytes written
uint lpOverlapped // overlapped buffer
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool FlushFileBuffers(
IntPtr hHandle);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool DisconnectNamedPipe(
IntPtr hHandle); [DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetNamedPipeHandleState(
IntPtr hHandle,
ref uint mode,
IntPtr cc,
IntPtr cd); [DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WaitNamedPipe(
String name,
int timeout); [DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(
IntPtr hHandle); [DllImport("kernel32.dll", SetLastError = true)]
public static extern uint GetLastError(); } [StructLayout(LayoutKind.Sequential)]
public class Overlapped
{
} [StructLayout(LayoutKind.Sequential)]
public class SecurityAttributes
{
}
}