Juergen Schmidt wrote:
> denis wrote:
>> But now I have noticed that when using bootstrap(), OpenOffice
>> does not accept TCP/IP-connections anymore (I've changed
>> Setup.xcu so OO would normally listen on a port).
>> 
>> I managed to accept TCP-clients manually using
>> com.sun.star.connection.Acceptor.  But this way I have to create
>> my own thread and take care about the whole client managing which
>> seems to be very error-prone (currently I get random segfaults).
>> 
>> So my question is now: How do I start OO with bootstrap() and
>> still accept TCP/IP-clients?
>
> That is currently not possible. The bootstrap() mechanism connects 
> always via a named pipe.

OK, then I have to do accept() by myself.

Currently I only have the code below, which already works quite
well.  But I wonder if there is more I have to take care about.

Can this code run safely in his own thread? ('serviceManager' and
'context' are retrieved in the main thread after bootstrap())

Do I have to take care about the clients in some way?

Thanks for any hints and pointers.

Here is the code:

  struct ServiceManagerProvider :
              public cppu::WeakImplHelper1<XInstanceProvider> {
      Reference<XInterface> serviceManager;

      ServiceManagerProvider (Reference<XInterface> smgr):
        serviceManager(smgr) {
      }
  
      Reference<XInterface> SAL_CALL getInstance (const rtl::OUString& name)
        throw () {
          if (name == Ostr("StarOffice.ServiceManager"))
              return serviceManager;
          return 0;
      }
  };

  Reference<XAcceptor> acceptor(serviceManager->createInstanceWithContext(
                  Ostr("com.sun.star.connection.Acceptor"),
                  context),
          UNO_QUERY);
  Reference<XBridgeFactory> bridgeFactory(
          serviceManager->createInstanceWithContext(
                  Ostr("com.sun.star.bridge.BridgeFactory"),
                  context),
          UNO_QUERY);
  OUString connstr(connectionString(host, port));
  for (;;) {
      Reference<XConnection> client(acceptor->accept(connstr));
      if (!client.is())
          return;
      bridgeFactory->createBridge(Ostr(""), Ostr("urp"), client,
              new ServiceManagerProvider(serviceManager));
  }


__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen 
Massenmails. 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to