From: Revar D. <rev...@gm...> - 2005-05-15 00:27:28
|
My program Trebuchet currently attempts to open a server socket at startup. If the socket is already bound (if the program was run twice), the new process sends a message to the server socket asking the first process to do the task the new process was going to do, then the new process exits. This lets me have one instance of the program handle external requests via command-line. ie: trebtk --connect domain1.com:8888 ;#(Starts Treb, connects to domain1.com) trebtk --connect domain2.com:5201 ;#(Causes first Treb to also connect to domain2.com) This implementation is, to put it nicely... inelegant and ugly as hell, and probably a security issue. So I went to rewrite it with the [send] command. Under OS X, the comments in file tkMacOSXSend.c pretty much say that [send] will _not_ currently work for inter process communications on the Mac. It further goes on to suggest how to implement it. So I'm thinking, sure, I'll see if I can figure that out. It suggests that Tk needs to record it's appnames using a Gestalt(), to keep a system- side table for appname to processes id lookups. So I go reading docs. The docs for the Gestalt Manager say, though, that under OS X, Gestalt() is per process, so you _can't_ use Gestalt() to do the storage for this. If Gestalt() is unworkable (and deprecated, no less), what is the suggested OS X way to keep a system-wide table of tcl appnames? A shared memmap file somewhere? - Revar |