Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2007

Tip: Looking for answers? Try searching our database.

IPC: Shared Files vs. Named Pipes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fahad.usman@gmail.com - 07 Aug 2007 09:20 GMT
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.microsoft (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')
ajk - 07 Aug 2007 12:36 GMT
>I am making an application in which if the second instance of the same
>application is launched, it checks its command-line arguments and
[quoted text clipped - 12 lines]
>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
Ben Voigt [C++ MVP] - 07 Aug 2007 23:39 GMT
>I am making an application in which if the second instance of the same
> application is launched, it checks its command-line arguments and
[quoted text clipped - 8 lines]
> 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.microsoft (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')

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.