Hi all,

often it has been talked about that OOo is perfectly capable of acting
as a server on one machine and listening for UNO connections from
other machines.
Up till now I haven't seen a lot of examples showing this, so I just
wanted to test if this was practically possible (inspired by a
question on oooforum.org) and started a soffice process in listening
mode in my wlan on Mac OS X Tiger. I chose to use Starbasic as it
shows that you can purely do a socket connection with the OOo API.

I used the UnoUrlResolver service as it is used in other languages as
well to connect to a running Office, but you can probably also use the
XConnector which gives you more low-level power. Also there is a
Socket service in the io module.

Of course it is probably not that efficient to use Starbasic, since
you need to run OOo two times (on server and client machine) but well,
it works ;-).
I executed the SB code from a Win32 machine, having tested just this
case up till now (Win32->Mac OS X), of course you shouldn't have
firewalls running and make sure there are no heavy security settings
turned on, in case you want to test the code.

<code>
Sub connectToRemoteOffice()
 '192.168.2.103 is the TCP/IP address of the server running OOo with 
 '"-accept=socket,host=0,port=8100;urp;StarOffice.ServiceManager"'
 res = createUNOService("com.sun.star.bridge.UnoUrlResolver")
 remotemgr = 
res.resolve("uno:socket,host=192.168.2.103,port=8100;urp;StarOffice.ServiceManager")
 desk = remotemgr.createInstance("com.sun.star.frame.Desktop")
 desk.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array()) 
'look on the server monitor now :-)
End Sub
</code>

As you can see it's just a few lines, so it's very simple and clean
code. Hope this helps someone out there somehow.

-- 
Best Regards
Christian Junker

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

Reply via email to