named-pipes

Non-Blocking File IO in Java

淺唱寂寞╮ 提交于 2019-12-17 18:50:07
问题 I want to write to a named pipe (already created) without blocking on the reader. My reader is another application that may go down. If the reader does go down, I want the writer application to keep writing to that named pipe. Something like a this in Java fopen(fPath, O_NONBLOCK) So that when the reader comes up, it may resume from where it failed. 回答1: First I try to answer your questions. Next I will try to show you a code snippet I created that solves your problem using blocking IO. Your

How to create a named pipe in node.js?

你。 提交于 2019-12-17 17:36:17
问题 How to create a named pipe in node.js? P.S.: For now I'm creating a named pipe as follows. But I think this is not best way var mkfifoProcess = spawn('mkfifo', [fifoFilePath]); mkfifoProcess.on('exit', function (code) { if (code == 0) { console.log('fifo created: ' + fifoFilePath); } else { console.log('fail to create fifo with code: ' + code); } }); 回答1: Looks like name pipes aren't and won't be supported in Node core - from Ben Noordhuis 10/11/11: Windows has a concept of named pipes but

Python read named PIPE

青春壹個敷衍的年華 提交于 2019-12-17 15:42:38
问题 I have a named pipe in linux and i want to read it from python. The problem is that the python process 'consumes' one core (100%) continuously. My code is the following: FIFO = '/var/run/mypipe' os.mkfifo(FIFO) with open(FIFO) as fifo: while True: line = fifo.read() I want to ask if the 'sleep' will help the situation or the process going to loss some input data from pipe. I can't control the input so i don't know the frequency of data input. I read about select and poll but i didn't find any

How do I perform a non-blocking fopen on a named pipe (mkfifo)?

我的未来我决定 提交于 2019-12-17 09:51:41
问题 If I have a program which creates and attempts to open a named pipe using mkfifo, how can I open a pipe for reading or writing without blocking? Specifically, I'm writing a C program which can be run with or without a gui (written in Java). In the C program, I successfully create the named pipes using mkfifo, however when I do FILE* in = fopen(PIPE_IN, "r"); /* Where PIPE_IN is the filename*/ fopen doesn't return until the GUI opens that pipe for writing. What I wish to do is have that pipe

Example of Named Pipes

南楼画角 提交于 2019-12-16 22:22:11
问题 How do I write a simple--bare minimum needed for it to work--test application that illustrates how to use IPC/Named Pipes? For example, how would one write a console application where Program 1 says "Hello World" to Program 2 and Program 2 receives message and replies "Roger That" to Program 1. 回答1: using System; using System.IO; using System.IO.Pipes; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[]

Reading continuous data from a named pipe

僤鯓⒐⒋嵵緔 提交于 2019-12-13 19:11:36
问题 I have been trying to read continuous data from a named pipe. But for some reason if I don't put a delay, the receiver will just stop reading and only a blank screen is shown after a few samples. I need to send continuous data that might change in milliseconds, so that's why putting a delay wouldn't work. I am trying to simulate it first using a while loop (the real script will be reading financial data). This is my first attempt: This is the sender, a python script: import os import time try

Named Pipes Across Network Gives “The user name or password is incorrect”

送分小仙女□ 提交于 2019-12-13 18:08:24
问题 To Anyone who can help! I have been trying to have a c# application that talks named pipes work across a network between two pc's. The applications work perfectly on the same pc and on pc's within the same domain. But I have issues when one pc is in a "Workgroup" and one is on a domain. Security on the server is not an issue, I can make it as open as possible. Background Info: Client - PC is in a domain, can connect to server via c$ admin share Server - Not in a domain, application running as

NamedPipe multiple servers

余生颓废 提交于 2019-12-13 14:08:59
问题 For simple IPC I have chosen NamedPipes to communicate between process (local). Due to changing requirements there shall be multiple instances of the server, which leads to multiple "listeners" on the same pipename. But there seems to be a problem. Only one of those listeners gets the message, every other instance does not. Is there some way of "broadcasting" messages? I already have seen this question, which is basically the same question, but it has no answer. CODE: Right now I use the

C - Terminating a process with signal()

℡╲_俬逩灬. 提交于 2019-12-13 10:18:39
问题 I have a server and a client. The client has the option to terminate the server. For that im using: void killServer() { int server_p_id; FILE *file; file = fopen(SERVER_INFO, "r"); if(file == NULL) { fprintf(stderr, "\nErro ao abrir %s", SERVER_INFO); exit(EXIT_FAILURE); } fscanf(file, "%d", &server_p_id); fclose(file); kill -9 -server_p_id; unlink(SERVER_FIFO); } /* some code */ if (!strcasecmp("fim",buffer)) { signal(SIGUSR1, killServer); break; } The problem is that the process is not

how to make client to check if the server is done with read operation from pipe before writing data into pipe in c++

心已入冬 提交于 2019-12-13 05:09:02
问题 I need my client to first check if server is reading data from pipe, if yes then wait till server is done else write data into pipe. If I don't use sleep command in my sample client program then Server doesn't read message properly.I found the reason of this issue from the documentation it says: This buffer must remain valid for the duration of the read operation. The caller must not use this buffer until the read operation is completed. But it doesn't specify how to block client until the