public virtual void Connect() { Logger.Debug("connecting"); try { EnvUtils.InitUno(); SocketUtils.Connect(); //var sock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); XComponentContext localContext = Bootstrap.bootstrap(); //XComponentContext localContext = Bootstrap.defaultBootstrap_InitialComponentContext(); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = (XConnector)localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext); XConnection connection = connector.connect(_connectionString); XBridgeFactory bridgeFactory = (XBridgeFactory)localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext); _bridge = bridgeFactory.createBridge("", "urp", connection, null); _bridgeComponent = (XComponent)_bridge; _bridgeComponent.addEventListener(this); _serviceManager = (XMultiComponentFactory)_bridge.getInstance("StarOffice.ServiceManager"); XPropertySet properties = (XPropertySet)_serviceManager; // Get the default context from the office server. var oDefaultContext = properties.getPropertyValue("DefaultContext"); _componentContext = (XComponentContext)oDefaultContext.Value; _connected = true; Logger.Info("connected"); } catch (NoConnectException connectException) { throw new OpenOfficeException("connection failed: " + _connectionString + ": " + connectException.Message); } catch (Exception exception) { throw new OpenOfficeException("connection failed: " + _connectionString, exception); } }