[Pythonmac-SIG] Correct way to send info to running program
Dethe Elza
delza at livingcode.org
Sat May 28 20:10:00 CEST 2005
Bob wrote:
> NSDistributedNotificationCenter?
>
> You didn't really specify what your requirements are...
>
I'm trying to set up a "simplest thing that could possibly work" for
getting events from another application which doesn't really play
well with others. I have hacked it enough that it logs the events I
want to the console, so I can, for example, put a tail -f console.log
| grep [events I'm interested in] | sendMessageToMyApp. I was
intending to make "sendMessageToMyApp" be based on datagrams using
something along the lines of:
import socket
host, port = 'localhost', 8081
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto('some data from the command-line', (host, port))
But I was thinking that I could use NSPort to receive these messages,
which was totally off base. I can apparently use CFSocket, but
realized that I should do a reality check and see if there's a better
way than the somewhat convoluted and roundabout path I'd set up.
It looks like NSDistributedNotificationCenter might work. I'll try
it out.
Thanks!
--Dethe
More information about the Pythonmac-SIG
mailing list