realbasic-nug
[Top] [All Lists]

Re: Multiple app instances

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Multiple app instances
From: Steve Roy <sroy at mac dot com>
Date: Sun, 30 Jan 2005 09:02:13 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <41FCCE58 dot 6050807 at adinet dot com dot uy>
On Jan 30, 2005, at 7:08 AM, Mario Buchichio wrote:

Could't find any info in this matter:
How do I avoid launching another instance of my app when opening a document from the desktop? My app is already running and when I double click a document to be opened by my app another instance is launched?

You're supposed to use an IPCSocket for that, but in my own tests it wasn't always working so I implemented my own scheme with a plain TCPSocket.

The general idea is that your running application has a server socket opened and listens for incoming data. When it launches, it should try to make a connection. If it's unsuccessful then it knows there are no other instances running and it can set up the server socket. However if it can connect, then the app can pass its command line to the first instance and just quit.

Steve

--
Steve Roy <sroy at mac dot com>
Personal homepage: <http://homepage.mac.com/sroy>
Projects homepage: <http://www.roydesign.net>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>