On Monday 19 August 2002 2:30 pm, Lars Gullik Bjønnes wrote: > | Anyway, I'm perfectly happy to use named sockets rather than pipes, but > | AFAICS there is still a problem. If I'm an external program, how do I > | find out the /name/ of this named socket if LyX is going to have many of > | them. Without this info I can't even start. > > .lyx/server-socket.1234 > .lyx/server-socket.4634 > .lyx/server-socket.P > > Every instance of LyX will only have _one_ socket.
This seems reasonable. It looks to me like we can use André's pipestream class today. Excellent. Future Windows support will follow by enhancing Pipestream. LyX will know nothing about it. As a bit of fun, a shell client would presumably ascertain which LyX socket to connect to like this (below). Angus #! /bin/sh # A wee shell script to ascertain which LyX socket to connect to PREFIX=.lyx/server-socket. # Commented out for now #SOCKETS=`ls ${PREFIX}*` # A temporary test SOCKETS=`echo "${PREFIX}1234\n${PREFIX}4634"` if [ "${SOCKETS}" = "" ]; then echo "No sockets open" exit fi PARSABLE_PREFIX=`echo ${PREFIX} | sed 's,\/,\\\/,'` SOCKET_IDS=`echo "${SOCKETS}" | sed "s/${PARSABLE_PREFIX}//"` echo ${SOCKET_IDS} | grep " " > \dev\null if [ $? -eq 0 ]; then # Multiple sockets exist. Choose one echo Multiple sockets exist. Choose one of ${SOCKET_IDS} read ID if [ "${ID}" = "" ]; then echo Bye! exit 0; fi echo ${SOCKET_IDS} | grep ${ID} > \dev\null if [ $? -ne 0 ]; then echo Bye! exit 0; fi else ID=${SOCKET_IDS} fi CHOSEN=`echo ${PREFIX}${ID}` echo Chosen socket is ${CHOSEN}