Hi Ariel, Thanks for the reply. I tried with modifying my code to wait till, OO stats. But still, am ending with same exception. To check whether the port has been opened in listening mode, I got the following result for telnet and netstat (no listing of this port in netstat)
admin$ telnet localhost 2081 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. e??'com.sun.star.bridge.XProtocolPropertiesUrpProtocolProperties.UrpProtocolPropertiesTidݓ?? admin$ netstat -ntpl | grep soffice netstat: l: unknown or uninstrumented protocol admin$ netstat -a | grep soffice admin$ But using lsof i could get the required information and can confirm that the port 2081 in my case, is being used by soffice and running in listening mode. admin$ lsof -i :2081 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME soffice 5150 admin 15u IPv4 0xffffff8015034320 0t0 TCP localhost:kme-trap-port (LISTEN) Also when i try to run your sample application, I get error, "OpenOffice.org quit unexpectedly" and doesn't launch the process. Let me know if you need more details on it. Thanks, Anandh On Tue, Feb 26, 2013 at 6:24 PM, Ariel Constenla-Haile <arie...@apache.org>wrote: > Hi Anandh, > > On Tue, Feb 26, 2013 at 10:58:43AM +0530, Anandha Kannan wrote: > > Hi, > > > > I have an issue in resolving UNO URL after launching open office > from > > my applicaiton developing in Mac. > > I start open office using socket as > > "-accept=socket,host=localhost,port=2081;urp;" > > > > This starts OO. Now to open a file passed from my application, I have the > > following code, > > > > rConnectionString = OUString::createFromAscii( > > "uno:socket,host=localhost,port=2081;urp;StarOffice.ServiceManager"); > > > The connection URLs look fine (hint: use StarOffice.ComponentContext to > get the component context directly, no need to go through the service > manager. > > And you'll find more useful a connection aware client, instead of using > the com.sun.star.bridge.UnoUrlResolver, see > > http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Example:_A_Connection_Aware_Client > > Quoting from > > http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Importing_a_UNO_Object > > The usage of the UnoUrlResolver has certain disadvantages. You cannot: > > - be notified when the bridge terminates for whatever reasons > - close the underlying interprocess connection > - offer a local object as an initial object to the remote process > > I've just uploaded an example (compiled only on Linux, later I'll test > it on Win and MacOS too): > > http://svn.apache.org/viewvc/openoffice/devtools/sdk-examples/trunk/cpp/cppbindings/ConnectionAwareClient/ > > > Here, I get exception saying *Connector: couldn't connect to socket > > (Undefined error: 0). *What is the wrong with the UNO URL that causes > this. > > Do you try this code right after launching OpenOffice? May be the > application didn't start listening at that moment, you may have to wait > and give the application a little time to perform the start up actions. > > > > PS: After launching OOo, Using PortScan utility I can confirm that the > port > > has been opened. > > You can test with telnet: > > telnet localhost 2081 > > You will get a request from the bridge counterpart (in URP protocol). > Also try with > > netstat -ntlp | grep soffice > > > Look at the example I quoted above, at the beginning it has > a std::cin.get() in order to wait for the application to start, I'm sure > that if you remove this, the example will fail because the office > started quickly but isn't listening yet. This might be your problem too; > of course, in a real application you don't put cin.get()'s ;) you'll > need a better solution (the C++ binding provides multiplatform > facilities - osl::Condition, osl::Thread, etc.). > > > Regards > -- > Ariel Constenla-Haile > La Plata, Argentina >