Solved

Using _pipe in Windows application

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

863 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

24 Experts available now in Live!

Get 1:1 Help Now