Connecting to LibreOffice with named pipes
Question: I can connect with sockets just fine, but I heard that using pipes is faster
when everything is local, so I wanted to try it out, but I can't get a
connection.

I start Libre with

    
    
     > soffice --headless --invisible --norestore --nodefault --nolockcheck --nofirstwizard --accept='pipe,name=ooo_pipe;urp;'
    

And the bare minimum python script that should work but doesn't is

    
    
    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)
    


Answer: I've used socket mode so far. Just tested pipe on my machine by the 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 the connection
in Python. At the start of the experiment, there were occasions that no foo is
generated and hence com.sun.star.connection.NoConnectException was raised. But
I can't repeat this error after that.

We've used socket-mode headless soffice in production for several years and
its very stable and fast enough. Seems pipe mode here still relies on unix
socket, so I suggest using socket mode.

