named-pipes

WriteFile on a named pipe sometimes returns ERROR_NO_DATA

帅比萌擦擦* 提交于 2019-12-01 08:50:29
I've got a C++ program that is creating a named pipe to write data to. Some customers have reported a situation where the client connects to the named pipe but the server end fails to write the data (with ERROR_NO_DATA ). This error code isn't really explained in any MSDN page that I could find; does anyone have any ideas on how to fix this? Or what the cause is? Open code: ostringstream pipeName; pipeName << "\\\\.\\pipe\\unique-named-pipe-" << GetCurrentProcessId(); pipeHandle = CreateNamedPipeA( pipeName.str().c_str(), // pipe name PIPE_ACCESS_DUPLEX, // open mode PIPE_TYPE_BYTE | PIPE

How to use named pipes in PHP between different functions or even different processes without fork?

戏子无情 提交于 2019-12-01 06:53:16
问题 I want to write an Ajax web application, a game to be specific. Two web clients have to communicate with each other via the PHP server. My approach to solve this is to use Ajax between client and server and server and client. Each client creates a separate server process using Ajax. I want that these two server processes communicate via MySQL and via named pipes. I need the named pipes to get immediate response for the whole application. I cannot use one server process, which first creates a

WriteFile on a named pipe sometimes returns ERROR_NO_DATA

浪子不回头ぞ 提交于 2019-12-01 06:51:51
问题 I've got a C++ program that is creating a named pipe to write data to. Some customers have reported a situation where the client connects to the named pipe but the server end fails to write the data (with ERROR_NO_DATA ). This error code isn't really explained in any MSDN page that I could find; does anyone have any ideas on how to fix this? Or what the cause is? Open code: ostringstream pipeName; pipeName << "\\\\.\\pipe\\unique-named-pipe-" << GetCurrentProcessId(); pipeHandle =

How to use named pipes over network?

醉酒当歌 提交于 2019-12-01 06:36:23
问题 I'm trying to create a connection over network via named pipes. I'm doing it as it says in msdn. I create pipes server side with function. CreateNamedPipe( "\\\\.\\pipe\\myNamedPipe", DUPLEX | FILE_FLAG_OVERLAPPED, 0, 255, BUFFER_SIZE, BUFFER_SIZE, 0, IntPtr.Zero); and trying to connect via CreateFile() function CreateFile( "\\\\10.0.0.29\\pipe\\myNamedPipe", GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero); 10.0.0.29 is server machines ip. If I

How to continue sending/reading messages from named pipes / streams

六月ゝ 毕业季﹏ 提交于 2019-12-01 06:31:40
I'm teaching myself to use pipes and I have two apps, one with the PipeServer class and one with the PipeClient class (shown below). The server app creates an instance of the PipeServer and has a text box that calls the WriteMessage method when the text box changes. The client app creates an instance of the PipeClient, sets the MessageReadEvent to a method that fills in a textbox with the given message, and then calls the ReadMessages method. The first time the ReadMessages method is called it gets to the sr.ReadLine() and waits there until a message is received. After a message is received

Performance of sockets vs pipes

廉价感情. 提交于 2019-12-01 04:52:15
I have a Java-program which communicates with a C++ program using a socket on localhost. Can I expect to gain any performance (either latency, bandwidth, or both) by moving to use a native OS pipe? I'm primarily interested in Windows at the moment, but any insight related to Unix/Linux/OSX is welcome as well. EDIT: Clarification: both programs run on the same host, currently communicating via a socket, i.e. by making a TCP/IP connection to localhost:. My question was what are the potential performance benefits of switching to using (local) named pipes (Windows), or their Unix equivalent (AF

how to determine if pipe can be written

若如初见. 提交于 2019-12-01 03:29:47
Is there a way (in C, or preferably in Perl) to determine whether a named pipe may be written - i.e. there is an active reading process It seems that if I open for write nonblocking, the open returns at once but a select for write also returns immediately. The goal is for the writing process to just carry on (i.e. skip sending) if the reading end is not ready Chances are that you are not paying attention to the return codes from open . If you open a FIFO for writing and as non-blocking there are two possible outcomes. If there is already a reader the open will immediately return successfully.

Poll() on Named Pipe returns with POLLHUP constantly and immediately

六眼飞鱼酱① 提交于 2019-12-01 03:24:38
问题 I open a named pipe (fifo created by mkfifo) with non blocking flag (open(...O_NONBLOCK)) then start polling ( poll (...)). So far so good. Then from the command line I do a couple of echo 123 > /tmp/fifo They are all read out of the pipe as expected (at least I expect that's how they should work normally). My problem is that after the first echo, POLLHUP is set and it is stuck, poll returns immediately from that point. How do I clear / get rid of POLLHUP ? It starts to drive me crazy :( Yes

Performance of sockets vs pipes

心不动则不痛 提交于 2019-12-01 03:05:50
问题 I have a Java-program which communicates with a C++ program using a socket on localhost. Can I expect to gain any performance (either latency, bandwidth, or both) by moving to use a native OS pipe? I'm primarily interested in Windows at the moment, but any insight related to Unix/Linux/OSX is welcome as well. EDIT: Clarification: both programs run on the same host, currently communicating via a socket, i.e. by making a TCP/IP connection to localhost:. My question was what are the potential

How to work with named pipes (C++ server , C# client)

偶尔善良 提交于 2019-11-30 23:53:33
I am trying to get started with working with named pipes as I will need to use them for a project of mine in the future. At the moment I have a C++ server which waits until a client connects and sends over a test message. I roughly followed this tutorial to get started. The relevant code is below: #define MESSAGE L"TestMessage" HANDLE hnamedPipe = INVALID_HANDLE_VALUE; hnamedPipe = CreateNamedPipe( L"\\\\.\\pipe\\testpipe", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE| PIPE_READMODE_MESSAGE| PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL); if(hnamedPipe == INVALID