Daemons?

Regan Heath regan at netmail.co.nz
Wed Aug 15 05:13:47 PDT 2007


Deewiant wrote:
> Daniel Swe wrote:
>> I want a single instance of the program. So that when I write ./test -console
>> it doesnt really start a new instance of the program but instead connects to
>> the older instance.
> 
> I'd probably use sockets, as they're practically universally supported and don't
> require platform-specific code. If you're willing to go POSIX-only you could
> also try named pipes, as Regan suggested.
> 
> See also http://en.wikipedia.org/wiki/Inter-process_communication

Yeah, I was just about to suggest sockets.

If you use named pipes you will have code for windows and code for unix, 
or you could just ignore windows for your specific case.

Once you're done you could polish it up and suggest it gets included in 
Tango.

If you want to do that then take a look at tango.sys.Pipe because a 
NamedPipe will be almost identical to that.

The code to read/write the pipe can be found in tango.sys.Process.

Regan



More information about the Digitalmars-d-learn mailing list