Solved

Using _pipe in Windows application

Posted on 2013-06-12
1
255 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 32

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now