How to read from a named pipe in 'Message' mode [Windows]?

13 ビュー (過去 30 日間)
VariousFires
VariousFires 2015 年 5 月 27 日
回答済み: Ayush 2024 年 12 月 2 日
I am trying to read from a named pipe in Windows using the .NET framework. I am using the following code to connect to the pipe:
NET.addAssembly(System.Core)
pipeClient = System.IO.Pipes.NamedPipeClientStream('.','pipeName',System.IO.Pipes.PipeDirection.In);
pipeClient.Connect();
Once the pipe is connected, the pipeClient TransmissionMode and ReadMode are set to 'Byte,' but I want to read from the pipe in 'Message' mode. When I try to change the ReadMode, I get the following error:
>> pipeClient.ReadMode = System.IO.Pipes.PipeTransmissionMode.Message
Message: Access to path is denied.
Source: System.Core
HelpLink:
If anyone can help me, I'd greatly appreciate it!!
NOTE: I am not an object oriented programmer, so please be kind :-)...
  1 件のコメント
Dasharath Gulvady
Dasharath Gulvady 2015 年 5 月 28 日
Are you able to achieve this outside MATLAB? If yes, how are you doing this? If not, can you try outside MATLAB and make sure it works in the .NET environment?

サインインしてコメントする。

回答 (1 件)

Ayush
Ayush 2024 年 12 月 2 日
The error message you are encountering originates from .NET, specifically from "System.Core." This issue can likely be replicated in C#, allowing you to search for the error online for more information. For instance, searching for "Access to the path is denied. pipes" yields numerous helpful discussions. Access to named pipes, like other Windows resources, is governed by access control privileges, such as Access Control Lists (ACLs). I recommend checking for any references to access control, and if necessary, explicitly configuring these controls to allow access from other processes within your login session.
Regarding alternatives in MATLAB for inter-process data transfer:
Use of Named Pipes typically works well. An alternative is using shared memory, but programming shared memory is more difficult and error prone and my experience is that it is less of a performance boost that you might expect.

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by