named-pipes

How is a “handshake” generally implemented with regards to Named Pipes

坚强是说给别人听的谎言 提交于 2019-12-13 03:45:58
问题 I need to implement a handshake type protocol in to a small Linux program that uses named pipes to communicate with other processes. I've searched for a general implementation pattern for a handshake type protocol when using named pipes but I've not been able to turn anything up... I simply can't believe that there isn't patterns to do this. Can someone point me to a possible resource? In full disclosure this is for homework but implementing this pattern isn't the homework. We need to solve a

NetNamedPipe: varying response time when communication is idling

跟風遠走 提交于 2019-12-12 20:17:16
问题 I have two WCF apps communicating one-way over named pipes. All is nice, except for one thing: Normally, the request/response cycle takes zero (marginal) time. However, if there was a time span of, say, half a minute without any communication, the request/response increases up to ~300-500ms. I looked around the net and I got the idea of using a heart beat/ping mechanism to keep the communication channel busy. Using trial and error I found that when doing a request each 10 seconds, the

Programically get the system name of named pipe

血红的双手。 提交于 2019-12-12 16:20:36
问题 I am writing a inter-process comunication using WCF NetNamedPipeBinding. My goal is to have service running at "net.pipe://localhost/service", so I running the simplest host: host = new ServiceHost(contract, new Uri[] { "net.pipe://localhost" }); host.AddServiceEndpoint(typeof (IContract), new NetNamedPipeBinding(), "service"); host.Open(); According to http://blogs.msdn.com/b/rodneyviana/archive/2011/03/22/named-pipes-in-wcf-are-named-but-not-by-you-and-how-to-find-the-actual-windows-object

Using named pipes in a single process

谁说胖子不能爱 提交于 2019-12-12 15:52:21
问题 I am trying to use a named pipe for communication within a process. Here is the code #include <stdio.h> #include <fcntl.h> #include <signal.h> void sigint(int num) { int fd = open("np", O_WRONLY); write(fd, "y", 1); close(fd); } main() { char ch[1]; int fd; mkfifo("np", 0666); signal(SIGINT, sigint); fd = open("np", O_RDONLY); read(fd, ch, 1); close(fd); printf("%c\n", ch[0]); return; } What I want is for main to block till something is written to the pipe. The problem is that the signal

Redirect Input and Output of Powershell.exe to Pipes in C++

会有一股神秘感。 提交于 2019-12-12 14:23:51
问题 I am trying to execute powershell commands in C++ and get its output through pipes. My program works perfectly for cmd.exe. However, when I try to do the same thing with powershell.exe, I only get "W" as an output. I have commented the line in the code below that needs to be modified to execute powershell.exe Below is my code that works for cmd.exe: HANDLE stdinRd, stdinWr, stdoutRd, stdoutWr; DWORD readFromCmd(); DWORD writeToCmd(CString command); int main(int argc,char* argv[]) { SECURITY

NodeJS IO starved but timers still running?

∥☆過路亽.° 提交于 2019-12-12 12:35:53
问题 I've got a fairly complicated NodeJS application which manages various operations on a server. It listens for messages on a PubNub channel, and makes several requests to 3rd-party APIs. It also has a timer (using setTimeout) which runs every second to check that all relevant process are still running and healthy. Recently I've noticed some strange behaviour. Under certain circumstances (specific, but 100% reproduceable) it goes into a strange state where all network I/O stops working. PubNub

How to Enumerate Names of All Named Pipes in a Process?

北城以北 提交于 2019-12-12 11:52:17
问题 I need to open a certain named pipe so I can fuzz test it, however my test code does not have access to the same data used to generate the name of the named pipe. However I can recognize the name of the pipe and then use that name to open up the pipe for fuzzing. I used this forum post to start enumerating names of the handles on the system: http://forum.sysinternals.com/howto-enumerate-handles_topic18892.html However it seems that won't work with named pipes for some reason. TL;DR: What API

How can I test to see if a net pipe service is listening

大兔子大兔子 提交于 2019-12-12 10:56:50
问题 How can I test programmatically to see if a particular net pipe service is running and listening, so I don't get a "There was no endpoint listening at..." exception? So for instance if I have this code: Uri baseAddress = new Uri("http://localhost/something"); var _ServiceHost = new ServiceHost(typeof(Automation), new Uri[] { baseAddress }); NetNamedPipeBinding nnpb = new NetNamedPipeBinding(); _ServiceHost.AddServiceEndpoint(typeof(IAutomation), nnpb, "ImListening"); _ServiceHost.Open(); I

Named pipe client unable to connect to server running as Network Service

旧城冷巷雨未停 提交于 2019-12-12 10:38:06
问题 I have a service running under the Network Service account. The service just sets up a named pipe and listens for connections: NamedPipeServerStream listeningPipe = new NamedPipeServerStream("ourservicepipe", PipeDirection.InOut, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Message, PipeOptions.Asynchronous); listeningPipe.BeginWaitForConnection(OnPipeConnected, listeningPipe); I have an application running on a standard user account on the same machine. It tries to

Can you explain in more detail what's the difference between PIPE_READMODE_MESSAGE/PIPE_READMODE_BYTE?

你离开我真会死。 提交于 2019-12-12 09:35:13
问题 Though I've go through the document here, it still doesn't make sense to me what it is: Data is read from the pipe as a stream of messages. This mode can be only used if PIPE_TYPE_MESSAGE is also specified. 回答1: In BYTE mode, you are the one that needs to figure out the separation of the data so that it can be decoded at the receiving end. In MESSAGE mode, the API will do this for you. When you read the message on the other side you will have the whole block of data (the message). In both