Thread: talking between programs

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    108

    talking between programs

    I was about to post this in the linux forum, but thought it might be better to go cross platform..

    What is the best way to talk between programs? For example, suppose from the command line I launch two text editors.

    In windows sometimes they will just revert back to the same instance. For example, if I run

    enexpad moo.cpp,

    and then shortly after

    enexpad bar.cpp

    in windows this might sometimes just run one program, displaying two files. However, in linux most of the time (from my observation with many programs) they end up as two instances of enexpad.

    What is the best cross-platform way to enforce single-instance programs? Not sockets.. is it?

  2. #2
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    Sockets are the only thing that's cross platform portable.
    Pipes would be the other logical solution, but are highly platform specific.
    Third option would be writing a lockfile somewhere, but that's a dirty and risky solution and therefore not recommended (what if the open client crashes and doesn't delete the lockfile while doing so...).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting programs
    By Molokai in forum C Programming
    Replies: 1
    Last Post: 04-16-2009, 10:10 AM
  2. Recommend upgrade path for C programs
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-22-2007, 07:32 AM
  3. Two programs talking via tcp-ip
    By CSoFun in forum C++ Programming
    Replies: 3
    Last Post: 01-19-2003, 02:52 PM
  4. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM
  5. Programs Communicating
    By Drek in forum C++ Programming
    Replies: 1
    Last Post: 01-26-2002, 04:47 PM