[英]Why does os.path.exists() stop windows named pipes from connecting?
[英]Connecting to LibreOffice with named pipes
我可以很好地连接套接字,但我听说当一切都是本地的时候使用管道会更快,所以我想尝试一下,但我无法获得连接。
我和Libre一起开始
> soffice --headless --invisible --norestore --nodefault --nolockcheck --nofirstwizard --accept='pipe,name=ooo_pipe;urp;'
最简单的python脚本应该可以工作,但不是
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)
到目前为止我已经使用了套接字模式。 刚刚在我的机器上通过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显示有一个命名的socket foo,它可以在Python中获得连接。 在实验开始时,有时候没有生成foo,因此引发了com.sun.star.connection.NoConnectException。 但在那之后我不能重复这个错误。
我们已经在生产中使用了插座模式无头门槛数年,并且它非常稳定和快速。 看来这里的管道模式仍然依赖于unix socket,所以我建议使用套接字模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.