Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using _pipe in Windows application

Posted on 2013-06-12
1
Medium Priority
?
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
sarabande earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

597 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