Connecting to LibreOffice with named pipes
I can connect to the sockets very well, but I heard that using pipes is faster when everything is local, so I wanted to try it, but I can't get the connection.
I am starting Libre with
> soffice --headless --invisible --norestore --nodefault --nolockcheck --nofirstwizard --accept='pipe,name=ooo_pipe;urp;'
And a minimal python script that should work but is not
import uno from com.sun.star.connection import NoConnectException pipe = 'ooo_pipe' localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext) context = resolver.resolve("uno:pipe,name=%s;urp;StarOffice.ComponentContext" % pipe)
source to share
I used socket mode. Just test the pipe on my machine with cmd:
/usr/lib/openoffice/program/soffice.bin -accept='pipe,name=foo;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard -invisible $ lsof -c soffice|egrep "pipe|foo" soffice.b 6698 user 3r FIFO 0,8 0t0 15766935 pipe soffice.b 6698 user 4w FIFO 0,8 0t0 15766935 pipe soffice.b 6698 user 15u unix 0xffff88009773ed00 0t0 15767001 /tmp/OSL_PIPE_1000_foo
lsof shows that there is a named socket foo and its OK to get a connection in Python. At the start of the experiment, there were cases where foo was not generated and hence com.sun.star.connection.NoConnectException was thrown. But after that I cannot repeat this error.
For several years we have been using socket-mode headless spotlight and are very stable and fast enough. It seems that the pipe mode here still depends on the unix socket, so I suggest using socket mode.
source to share