473,732 Members | 2,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IPC: Shared Files vs. Named Pipes

I am making an application in which if the second instance of the same
application is launched, it checks its command-line arguments and
passes them to the already running instance. I have been told by
someone that using named pipes is one of the most commonly used ways
of doing this. But I did it in a simpler way; I saved the command-line
arguments in a text file and passed a message to the previously
running instance to read the arguments from that file. The second
instance then terminates and the first instance deletes the file after
reading the arguments from it. This technique is working perfectly
fine for me, but I was just wondering that are there any drawbacks in
this approach or am I going to get any advantage if I do it using
named pipes?

(I read on support.microso ft (http://support.microsoft.com/kb/q95900)
that shared files is one of the ways for IPC but i am not sure what i
am doing is actually that 'shared files')

Aug 7 '07 #1
2 2541
ajk
On Tue, 07 Aug 2007 08:20:10 -0000, fa*********@gma il.com wrote:
>I am making an application in which if the second instance of the same
application is launched, it checks its command-line arguments and
passes them to the already running instance. I have been told by
someone that using named pipes is one of the most commonly used ways
of doing this. But I did it in a simpler way; I saved the command-line
arguments in a text file and passed a message to the previously
running instance to read the arguments from that file. The second
instance then terminates and the first instance deletes the file after
reading the arguments from it. This technique is working perfectly
fine for me, but I was just wondering that are there any drawbacks in
this approach or am I going to get any advantage if I do it using
named pipes?

(I read on support.microso ft (http://support.microsoft.com/kb/q95900)
that shared files is one of the ways for IPC but i am not sure what i
am doing is actually that 'shared files')
Why don't you just pass the cmdline arguments with the message?
Stuffing everything into a string, marshaling it and then sending it
to the other process should be a simple matter. I think frankly using
named pipes or shared memory is overkill in your case.

I am not quite sure about what environment you run in like security
requirements etc however generally I don't think it is a good idea to
do as you have done. It is better to keep everything inside the app.

hth/ajk
Aug 7 '07 #2

<fa*********@gm ail.comwrote in message
news:11******** **************@ d55g2000hsg.goo glegroups.com.. .
>I am making an application in which if the second instance of the same
application is launched, it checks its command-line arguments and
passes them to the already running instance. I have been told by
someone that using named pipes is one of the most commonly used ways
of doing this. But I did it in a simpler way; I saved the command-line
arguments in a text file and passed a message to the previously
running instance to read the arguments from that file. The second
instance then terminates and the first instance deletes the file after
reading the arguments from it. This technique is working perfectly
fine for me, but I was just wondering that are there any drawbacks in
this approach or am I going to get any advantage if I do it using
named pipes?
Well, what is the third instance going to do? Overwrite the file made by
the second instance?
>
(I read on support.microso ft (http://support.microsoft.com/kb/q95900)
that shared files is one of the ways for IPC but i am not sure what i
am doing is actually that 'shared files')

Aug 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1599
by: piyush | last post by:
Sorry for repeated posting but I couldnt get things right/completely in the first post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application API (which would be set up as a NT service). It could be C++ or C#. The API as such might be talking to the underlying application (UA) via WM_COPYDATA messages.
0
1816
by: piyush | last post by:
Sorry for repeated posts, I couldnt get things right and complete in the previous post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application API (which would be set up as a NT service). It could be C++ or C#. The API as such might be talking to the underlying application (UA) via WM_COPYDATA messages.
2
2817
by: J | last post by:
Hello, What is the best/easiest way to setup interprocess communication between a windows service and a webservice? The windows service will be running on the same machine that is hosting the web service. The web service will be calling the windows service to get information relating to the printers installed on this machine. J
2
1982
ipc
by: Dave | last post by:
Hi, What is the best way to communicate betwine c# application and unmanage c++ application (no sockets) and to pass data betwine them??? what are the all ways i can use?? Thaks
0
1671
by: Federico Caselli | last post by:
Hi, I need to communicate between two processes. I tryed using named pipes, but I'm afraid it's too complex for me... I'd like to explain what I need. The two processes must just exchange an array of two bytes. The successive writes should overwrite the previous ones. For example, the process A sends byte0=7, byte1=9 and then it sends byte0=8, byte1=10. The process B reads only after the second array is sent. The read array should be...
10
627
by: Oriane | last post by:
Hello, I have to share a object in RAM between several processes. I intend to design a special process to load this objet (an Autocad plan) in memory, and to take care of the read/write operations made by the other processes with WCF based on named pipes. Would you think it is a good idea ? Best regards
7
2675
by: Alex Y Wang | last post by:
Hi all, my current project is completely written in native C++, and for some reason I need to write a standalone .Net program to do some work for it. Therefore, I need to find an effective way of IPC between my unmanaged code and managed code. What's most appropriate IPC solution for this? Thanks in advance. Alex Y Wang
7
5480
by: adrin | last post by:
Hello, Could anybody tell me what are IPC mechanisms that .NET supports at present?(and what improvements were made in different framework versions)? Is IPC support windows dependent or is it designed to be more or less portable(does Mono support IPC?) tia --
2
6143
by: Bob | last post by:
The question about IPC between managed vs unmanaged comes up once in a while, and I generally see "Named Pipes" as the answer. But I was wondering if there is anything new. The app in this case will only be sharing short strings for the most part, and the C++ part will eventually be rewritting in C#. So I'm looking for anything that's fast and easy, but also not too ugly. Is it still necessary to use named pipes?
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.