开发者

Named pipe in VB6: CallNamedPipe() failed with error 87

开发者 https://www.devze.com 2023-03-08 16:13 出处:网络
I am using CallNamedPipe() in VB6 to send messages to a C# named pipe server. On the server side the pipe is created by:

I am using CallNamedPipe() in VB6 to send messages to a C# named pipe server. On the server side the pipe is created by:

new NamedPipeServerStream(pipeName, PipeDirection.InOut, numThreads);

On the client I use this call to write 2 bytes:

  Dim Header(1) As Byte
  Header(0) = 0
  Header(1) = 6
  res = CallNamedPipe(szPipeName, Header(0), 2, bArray(0), numBytes, cbRead, 3000)

The server saw the pipe connected because WaitForConnection() did return, but then could not read any bytes. On the client side: CallNamedPipe failed and returned error code 87 (invalid pa开发者_开发技巧rameters?)

My questions are:

  1. Is the pipe created a byte mode or message mode type? MSDN says CallNamedPipe() fails if the pipe is byte mode.

  2. Is there a way to write to a byte mode pipe in VB6. Do I have to change the server code to create a message mode pipe?

  3. How to get my VB6 code working?


According to the documentation, the pipe is in byte mode when you use that constructor. I don't know much about the non-.NET pipe calls, but I don't see any reason why not to set the server to a message mode pipe if the VB6 needs it.

0

精彩评论

暂无评论...
验证码 换一张
取 消