2012-03-19 4 views
3

소켓으로 연결할 수 있지만 모든 것이 로컬 일 때 파이프 사용이 빠르다고 들었습니다. 그래서 사용해보고 싶었지만 연결을 얻을 수 없습니다. 명명 된 파이프를 사용하여 LibreOffice에 연결하기

나는

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

와 리브레를 시작하고 작동하지만 수행해야 할 최소한의 파이썬 스크립트입니다

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) 
+2

무슨 뜻입니까? 이 스크립트가 무엇을 기대합니까? 대신에 당신은 무엇을 보나요? – subdir

답변

4

지금까지 소켓 모드를 사용한 적이 없습니다. 그냥 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를 파이썬에서 연결을 얻기 위해이 명명 된 소켓 foo에이고 그것의 확인을 보여줍니다. 실험이 시작될 때 foo가 생성되지 않아 com.sun.star.connection.NoConnectException이 발생하는 경우가있었습니다. 하지만 그 후에이 오류를 반복 할 수는 없습니다.

우리는 몇 년 동안 생산 중에 소켓 모드 헤드리스 수피를 사용했으며 그 안정성과 속도는 충분히 빠릅니다. 여기 파이프 모드는 여전히 유닉스 소켓에 의존하기 때문에 소켓 모드를 사용하는 것이 좋습니다.

관련 문제