Hi Chris,
Sorry for the delay [1]
On 15/02/12 10:39, Chris Weichenberger wrote:
> I have browsed Coot's online documentation searching for means of remote
> control. My goal would be to send commands to a running Coot instance from a
> Python script and it looks like the socket based approach mentioned in the
> documentation '13.28 remote-control' might do the job.
Yes. That was the plan.
The idea indeed was to send coot executable commands from another process.
> However, function
> documentation is pretty sparse,
yes, sorry about that. It was never taken up, so it was de-prioritized.
> so I wonder if there is someone who has
> already dealt with it and could provide some code snippets or a more in-depth
> explanation of the functions like 'open-coot-listener-socket',
> 'open-coot-listener-socket-with-timeout', 'coot-socket-timeout-func',
> 'coot-listener-idle-function-proc', 'eval-socket-string' and related.
Then elsewhere, you start a standard socket server. This is how I do it
in scheme:
(let ((s (socket PF_INET SOCK_STREAM 0)))
(setsockopt s SOL_SOCKET SO_REUSEADDR 1)
(bind s AF_INET INADDR_ANY 12345)
Then, with the server in place, your coot is supposed to run something
like:
(open-coot-listener-socket-with-timeout 12345 "localhost")
Then simply shove your python command strings constructed on the server
down this socket.
Python command string blocks should start with
"# PYTHON"
and end with
"; end-transmission#\newline"
(where #\newline is not literal, of course)
Full disclosure: I have spend a few minutes trying to get this to work
with a python socket server and it's not working as I hoped it would.
Hmm... - maybe this is the problem into which the Phenix people ran some
time ago.
Paul.
[1] Australia, NZ and illness.
|