FAQ Database Discussion Community


Why does using `execl` instead of `system` stops my program from working?

c,linux,unix,pipe,ipc
I'm trying to do basic IPC using pipes. I spent hours searching the internet, doing this and that, reading the API documentations, and ended up with the code below. But it does not work, as I quite expected. Just any help making my code 'work' would be many thanks. <edit>...

Does a python fifo have to be read with os.open?

python,ipc,fifo
I am experimenting with using fifos for IPC routines in Python, and have the following code to create the fifo, then start two threads to write to it at varying times and read continually from it to print out whatever is put on the fifo. It works when the fifo...

Merging a paid Android app with the free version

android,ipc,freemium
I have an Android app that comes in two versions: a free one and a premium one with more features that costs $0.99. I'd like to move to an In App Purchase approach where the premium features can be bought in the Free version. However, I obviously don't want to...

Shared memory and POSIX semaphores

c,concurrency,posix,ipc
I wrote simple consumer-producer program in C. It is working fine while I have 1 producer and 1 consumer. But it is acting strange when I increase number of consumers. I start the producer process Producer is producing I start the consumer process Consumer is consuming and producer is producing...

Usage of spinlock functions

c,ipc,spinlock
How do I use these functions? I have declared lock globally. pthread_spinlock_t lock; Also the spinlock is initialized locally. pthread_spin_init(&lock, 1); // non-zero as pshared for IPC But now I want to lock my critical integer and increment it. I have multiple processes running this in a loop: while(0 !=...

Semaphore value initialized to -1?

c,ipc,semaphore
I am trying to initialize a binary semaphore for some shared memory. I could not figure out why I hung on a semop to get the semaphore, and eventually found that the semaphore value was -1 and I was stuck waiting. What I don't get is why the semaphore value...

Socket to communicate between two processes (originated from C and Java) on the same machine

java,c,sockets,ipc
I need to transfer data from one process to another. I'm quite familiar with the subject when the two processes were originated from C code - not once I used files, signals and pipes in C-code to accomplish it, but never have I tried to do it between two processes...

unable to add elements to thread safe locking queue of shared pointers

multithreading,c++11,ipc,shared-ptr
I'm trying to create an inter thread message based communications using C++11 concurrency techniques. Anthony William's book 'Concurrency in Action' describes a thread safe locking queue which this implementation is based on. The difference between the thread safe locking queue that is described in the book and the one I...

How to write/read multiple times to a pipe

c,pipe,fork,ipc
I'm trying to make two child processes communicate with each other via pipe.First child have to write data 1 and data 2, and then second child writes data 3 and data 4. Then childrens read each other data and print them. This is the code that i have so far....

Issues with FIFO between a C process and a JAVA application

java,c,ipc,named-pipes,fifo
I have 2 applications, one written in C and the other in JAVA. Lets call these applications 'C' and 'JAVA'. C Creates a named pipe via mkfifo (have also tried mknod - no difference to the outcome) C forks off with the child process invoking a system() call to fire-up...

Communication between RESTful API's on same server with NodeJS

node.js,server,ipc
I am building two sets of services on a website (all written in NodeJS on the server), both are using a RESTful approach. For the sake of modularity I decided to make both services separate entities. The first service deals with the products of the site and the second specifically...

boost ipc new and delete operators

c++,boost,delete,ipc
I see an example in boost ipc (inter process communication) #include <boost/interprocess/shared_memory_object.hpp> #include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/sync/scoped_lock.hpp> #include <iostream> #include <cstdio> #include "doc_anonymous_condition_shared_data.hpp" using namespace boost::interprocess; int main () { //Erase previous shared memory and schedule erasure on exit struct shm_remove { shm_remove() { shared_memory_object::remove("MySharedMemory"); } ~shm_remove(){...

Win32 - separating data in multiple loaded DLL instances in pure C

c,multithreading,winapi,dll,ipc
I know this topic is often asked, but I found no answers for C. I can't use C++ for several compatibility issues (crossplatform compiling). So I had to rewrite engine in C. The engine itself uses Lua and several global variables (I know global is evil). Engine is used by...

Producer, consumer POSIX

c,concurrency,posix,ipc
I am trying to write simple producer consumer app using C POSIX semaphores. Consumer: int memoryID; struct wrapper *memory; int main(int argc, char **argv) { srand(time(NULL)); key_t sharedMemoryKey = ftok(".",MEMORY_KEY); if(sharedMemoryKey==-1) { perror("ftok():"); exit(1); } memoryID=shmget(sharedMemoryKey,sizeof(struct wrapper),0); if(memoryID==-1) { perror("shmget(): "); exit(1); } memory = shmat(memoryID,NULL,0); if(memory== (void*)-1) { perror("shmat():");...

Typecasting over a message queue in c

c,linux,casting,ipc
I am currently trying to send an integer over a message queue. I am typecasting the address of this integer to a (char *) since in the future I would like to accept other data types and this data is sent in a struct designed for use in message queues....

Bidrectional node/python communication

python,node.js,ipc
I'm trying to implement simple bidirectional communication between node and a spawned Python process. Python: import sys for l in sys.stdin: print "got: %s" % l Node: var spawn = require('child_process').spawn; var child = spawn('python', ['-u', 'ipc.py']); child.stdout.on('data', function(data){console.log("stdout: " + data)}); var i = 0; setInterval(function(){ console.log(i); child.stdin.write("i =...

shared memory programme is not working in c

c,unix,ipc
There are two programs are there one is call server which put content in shared memory and other is client which received a content from shared memory both in both programs it is attached successfully with shared memory but data is not display in client side. Client.c #include<fcntl.h> #include<sys/ipc.h> #include<sys/shm.h>...

C programming bi directional communication

c,unix,multiprocessing,ipc,inter-process-communicat
I am trying to make something work here, i have c program where my parent process creates a pipe so he can listen request from children process. These children are created dynamically, it is never the same number. So far, i managed to send the requests to the parent through...

Order of opening named pipes causing possible race condition?

c,pipe,ipc,named-pipes
I am trying to create a very basic client server communication between two processes using IPC via named pipes. I have 2 pipes, namely fifo_client and fifo_server I have the following two classes fifoclient.c and fifoserver.c that has the following lines of code to open the two pipes. fifoclient.c int...

How can two java apps communicate on two instances on EC2?

java,amazon-web-services,amazon-ec2,ipc
I plan on having two java Apps, each running on a separate instance on AWS Ec2, assume Parser application on instance1, and Indexer application on instance 2. When Parser is finished parsing docs, I want to send a bundle of docs to indexer instance so it can do its indexing....

memory mapping files for high frequency trading?

ipc,mmap,quickfix,fix,memory-mapping
I am working in a high frequency trading client for stocks in C++. I am using the quickfix/J library to receive information from my broker. I need these two processes to communicate (one written in Java and the other in C++) and the latency has to be minimized as much...

how to use share memory with Golang? [closed]

go,ipc
How does golang share or read other processes shared memory? I've checked some information, but did not find relevant information. Can anyone give me an example?

How to keep a real-time data read-in loop separate from more processing intensive operations in Python?

python,opencv,ipc,python-multiprocessing
So I have an OpenCV webcam feed that I'd like to read frames from as quickly as possible. Because of the Python GIL, the fastest rate at which my script could read in frames seems to be the following: #Parent or maybe client(?) script #initilize the video capture object cam...

How to notify an application from windows service using WCF

c#,wcf,windows-services,ipc
I have a windows service that continuously read data from a serial port, from this service I'd like to be able to notify a WPF application with the updated data using WCF; I thought about using callbacks. The windows service would call a WCF service's method which in turn would...

Portlet IPC after recieved Event

jsf,events,event-handling,ipc,portlet
I have a Navigation portlet which schows all Students, when a Student gets clicked im sending a event with the id of the clicked student to other portlets. Sending and receiving the event is not the problem, that works fine. What i don't get, is how to proceed with the...

Linux - c - ipc notification without context switch and low overhead?

c,linux,ipc,notify,low-latency
Context : Linux 64bits. I am very well versed in shared memories, different IPCs mechanisms. Currently, I am seeking something that could be used in userspace to notify change between two polled processes, to save cpu cycles. I already know about futexes, eventfd, slow signals and even char devices. But...

Stopping a process by sending SIGUSR1 and waking up by sending SIGUSR2

operating-system,ipc
How do I stop a process by sending SIGUSR1 and wake that up by sending SIGUSR2? Is it possible? Please help me out.

Sending an arrow key with fprintf

c,linux,special-characters,ipc,popen
I'm testing out pipes and have hit a little road block. I want to be able to simulate pressing the right arrow key through a file pointer opened by popen. The file pointer opens a display program on a different terminal, much like a projector. I would like to send...

Passing int using char pointer in C

c,exec,ipc
I'm trying to figure out how to pass an int using a char pointer. It fails once the int value is too large for the char. This is what I'm trying to figure out: char *args[5]; int i = 20; /*some other code/assignments*/ args[2] = (char *)&i; execv(path, args); How...

Can I use STDIN for IPC?

c,gcc,ipc,stdin
Can I use standard input for interprocess communication? I wrote the following gnu c code as an experiment, but the program hangs waiting for input after printing the character defined as val. Neither a newline nor fflush in the sending process seem to alleviate the problem. #include <unistd.h> #include <stdio.h>...

Preventing use of shared memory [closed]

java,unix,memory,ipc,shared
A java application I have made is apparently using shared memory, which is interfering with the deployment of other programs in my client's unix environment. It was never the intension to use any shared memory and I need to identify where it is being consumed. Program Overview: -Generic executable jar...

Bad address with mq_open

c,posix,ipc
I am trying to open a simple queue using mq_open but I keep getting error: "Error while opening ... Bad address: Bad address" And I have no idea why. int main(int argc, char **argv) { struct mq_attr attr; //max size of a message attr.mq_msgsize = MSG_SIZE; attr.mq_flags = 0; //maximum...

What is a good Inter-Process Communication method between C and PHP in Linux

php,c++,c,linux,ipc
I actually don't know whether I am asking a proper question. Let me describe my problem first. End user <-1-> web server (by PHP) <-2-> an internal process (by C or C++) <-3-> an external hardware The 1 should be something like ajax request. The 2 should be something like...

Proper implementation of an inter process communication (IPC)

linux,process,ipc,inter-process-communicat
Is the following a proper implementation of an inter-process communication? #include <stdio.h> #include <fcntl.h> #include <sys/poll.h> int main(int argc, char** argv) { if (argc > 1) { //Sending side struct stat buffer; if (stat("/tmp/PROCAtoPROCB", &buffer) != 0) mkfifo("/tmp/PROCAtoPROCB", (mode_t)0600); int fdFIFO = open("/tmp/PROCAtoPROCB", O_WRONLY | O_NONBLOCK); if (fdFIFO > 0)...

Expected behaviour of shm_unlink?

c++,ipc,shared-memory
Does shm_unlink store a reference count to determine when to delete the file? I ask because I have the following: Writer: #include <iostream> #include <sys/mman.h> #include <unistd.h> #include <fcntl.h> #include <cstdio> using namespace std; void Sleep(int ms) { usleep(ms * 1000); } int main() { int fd = shm_open("/Test", O_CREAT...