Solved

Using _pipe in Windows application

Posted on 2013-06-12
1
263 Views
Last Modified: 2013-08-20
Can one ue the function '_pipe' as a named pipe between applications whree there is NOT a parent/child relationship?

I have two applications that I want to have interprocess communications. One app, we'll call the server, creates the anmed pipe and the other app, we'll call the client, gets the file descriptors to the pipe by using CFile::Open then Cfile::Read. The client can start/stop at different times and is independent of the server.

So atain can '_pipe" be used in the above situation?

Thanks
0
Comment
Question by:atomicgs12
1 Comment
 
LVL 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 39243866
a pipe only can be used between parent and child process cause a call to _pipe returns two handles (one for read, one for write) and the parent would pass one of the handles to its child process it has spawned. if the second process is not a child process, it cannot inherit a handle from a process that is not its parent.

see the sample code in http://msdn.microsoft.com/en-us/library/aa298531(v=VS.60).aspx

instead of pipes you could use shared memory. you would create named shared memory by either program calling CreateMemoryMappedFile. the second of client or server would get a handle to the already created memory. a memory mapped file would be a piece of memory where client and server could write or read from. synchronisation would be made by a mutex.

see http://msdn.microsoft.com/en-us/library/dd997372.aspx for more information.

if both server and client have a windows message loop (a win32 process can run a message loop even if it runs in background) you could use windows messages for p2p communication, for example by using global memory and sending/receiving a handle to that memory by message.

Sara
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question