[wxPython-users] Having a single instance and forwarding document
open requests
Doug Anderson
doug at vitamindinc.com
Thu Sep 27 09:28:15 PDT 2007
Dusty,
Thanks for the followup! Yeah, it bugs me when I find a question
that's the exact same as mine (and with no answers) posted.
Your solution is probably the best one. I remember thinking about
it, but for some reason dismissed it. I figured that since I was
already using the filesystem for some communication (about the port
number), I might as well just go whole hog and use the filesystem for
all my communication. My solution (using the filesystem for all
communication) worked, but I bet the TCP method would be just a hair
more reliable (and more efficient, since I couldn't find a way to
efficiently block on a file being created).
BTW: for the person reading the archives, picking a "well-known" file
location should involve the use of:
wx.StandardPaths.Get().GetUserLocalDataDir()
-Doug
---
On Sep 27, 2007, at 11:05 AM, Dusty Phillips wrote:
> On 27/09/2007, Doug Anderson <doug at vitamindinc.com> wrote:
>> I decided against TCP socket, mostly because:
>> - You've got to pick an arbitrary port and hardcode it. If that port
>> is taken, you are stuck with a really obscure failure case (not
>> common, but I'm paranoid).
>> - You can't support multi-user systems well (each user should have
>> their own single instance), since their TCP sockets would collide.
>
> For the record (too many times I've seen mailing list archives with
> questions but not answers! ;-), this can be easily solved as follows:
>
> Pick an arbitrary open port at startup and store it in a well-known
> file location. It can be a different port for each user and isn't
> hard-coded.
>
> Dusty
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-
> help at lists.wxwidgets.org
>
More information about the wxpython-users
mailing list