| View previous topic :: View next topic |
| Author |
Message |
arnold General User

Joined: 20 Apr 2005 Posts: 7
|
Posted: Wed Apr 20, 2005 12:33 pm Post subject: Client/server connection via basic macro |
|
|
I'm quite new to macros under OO and am running OO 1.1.4 on a windows(me & 98 )/linux(debian/Mepis) network and would like to be able to send/receive messages to/from another machine (or possibly another program on the same machine) on the network via Inet sockets.
The main purpose is to have the other program return a suitably modified text string whenever it receives an input string from OO.
To test the code I have created a sender/listener in Perl. They can correspond with each other. Currently they communicate with each other on 'localhost' and at port 9000.
I have also reviewed the various pieces of code that seemed to deal with similar issues on the macro/api part of this forum. None of the ones I have found do what I want and I have tried to adapt
http://www.oooforum.org/forum/viewtopic.phtml?p=26353&highlight=http+request#26353
but without much success so far.
What I am looking for is a reference or code samples for such interprocess communications. The manuals I have been able to find on the OpenOffice.org site seem to all deal with Java and C++ and I am unsure how far they an be applied to Basic macros.
There are some comments in the documentation about making OO 'listen' on some port, but I don't quite see that this relates to what I want to do since I understand this part to be useful for 'driving' oo remotely.
Since I don't want to make this post too long, please let me know if I can supply extra information or answer any questions.
TIA,
Arnold |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
|
| Back to top |
|
 |
arnold General User

Joined: 20 Apr 2005 Posts: 7
|
Posted: Wed Apr 20, 2005 2:23 pm Post subject: |
|
|
Yeah, it looks like it is the way to go. After leaving this problem for a while and thinking about it a bit more, I have made some progress and I can now send a message to the perl receiver.
But I'm really 'walking blind' on this and so I'm not surprised to get errors, but much prefer to have something to guide my baby steps and give me more hints on what error message might mean and how to do things 'right'.
I'm mainly interested in finding out more documentation about the possible options for the various methods to handle a two-way 'conversation' with handshaking and without blocking.
Is there a way to test whether or not data is available or do I have to accept the whole thing locking up until data comes from the link and bomb completely if it does not?
Arnold |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Wed Apr 20, 2005 2:33 pm Post subject: |
|
|
| P.S. Did you try the UCB openFileReadWrite method ? They should have the available() and readsomebytes() methods correctly implemented (connector does not have them) |
|
| Back to top |
|
 |
arnold General User

Joined: 20 Apr 2005 Posts: 7
|
Posted: Wed Apr 20, 2005 3:48 pm Post subject: |
|
|
I had seen the bug report and aftwr reading it again, I was wondering if the problem applies only to WinXX platforms - I could not quite decide from the back and forth following the problem report
If it worked under linux, I might be able to move there until the problem is fixed so I can get on with it. Testing it might be my next possible step forward/sideways - although I'm a bit wary - who knows what other issues will then come to the fore .
After looking over the references for UCB openFileReadWrite it does not seem to be usable for my case, since I don't know how to express the returned data as a suitable URL - unless of course I write to a fixed file first and then transfer it that way - which really seems round-about way of doing it  |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Wed Apr 20, 2005 4:44 pm Post subject: |
|
|
I have only Windows available, and I m not aware if the bug is also there on linux.
The UCB methods can not only read from / write to local files, but also to http://... addresses with specified port number / password. The format is somewhere in the SDK (but I do go to bed now and do not search for it ). So if you talk to your perl scripts via the standard GET syntax, the UCB methods could be working. |
|
| Back to top |
|
 |
arnold General User

Joined: 20 Apr 2005 Posts: 7
|
Posted: Thu Apr 21, 2005 8:29 am Post subject: |
|
|
I guess we do have to sleep sometimes
To use the UCB methods via http would mean I have to make the other end look like a web server - not sure that is an efficient way for me to go since I know little about the implications.
I'll have a look around - perhaps if I set up things properly, since the oo end is initiating the conversation, I may be able to get away with blocking on the receive.
Just the same, thank you for your comments
Arnold |
|
| Back to top |
|
 |
|