Communication through IP port (OpenInsight 32-Bit)
At 05 MAY 2003 10:36:06AM Wilhelm Schmitt wrote:
How can I establish communication between 2 engines via IP port?
Regards
Wilhelm
At 05 MAY 2003 12:44PM Pat McNerthney wrote:
Error=CreateEngine(hEngine, "\\.:1234", "EXAMPLES", CREATE_ENGINE_OPEN_ALWAYS$)Will establish communication between 2 engines on the same machine via IP port number 1234.
Pat
At 06 MAY 2003 08:17AM Dave Berkovsky wrote:
Pat,
Is there such a thing as OpenEngine User's Guide.
I am new to this subject and trying to learn as much as I can.
Thanks
Dave
At 06 MAY 2003 09:07AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Dave,
There's a help file in your OpenInsight Directory called OpenEngine.chm that contains the information that will help you with this. There are also postings in this list like this one that should help you.
Regards
World leaders in all things RevSoft
At 06 MAY 2003 03:39PM Wilhelm Schmitt wrote:
Sprezz,
I tried to run the example program "cp_oe_external_test".
When it comes to the line
error=createEngine( hEngine,"\\127.0.0.1:888","SYSPROG", CREATE_ENGINE_OPEN_ALWAYS$, 1 )
The program aborts and sends the error SYS1000: Error loading program "CREATEENGINE".
Do I have to run another process first?
Regards
Wilhelm
At 07 MAY 2003 08:03AM Bob Orsini wrote:
Go to the help in OI and look up the oengine section of the programmers reference. Proceed to setup. You have to add certain functions to the dll_oengine in OI before using the function.
At 07 MAY 2003 08:50AM Bob Carten wrote:
you should not need to mess with adding dlls,
just use
$Insert Revcapi Equates
I have been working with a set of programs to let me connect to remote engines on another server.
I am not sure I have found the best way, but here is what I have done to date:
The pieces I use are:
remote host:
run oengine as a service sitting at a known port using srvany.exe
have a program like REVCAPI_SPAWN, listed below that will create a new engine for you, or choose from a list of existing engines
Local machine:
run a program like test_spawn below, have it call to the address where you put the remote engine.
Known Issues:
The code below does not correctly shut down the remote engines after it creates them.
Thus, I recommend modifying it to create a list of engines and doing a round-robin through them.
HTH
Bob
subroutine test_spawn(spawner_address)
* Use listening engine to spawn my own engine on a remote server, return the address of my server
*
declare function revcapi_spawn
$insert revcapi_equates
this is the address of an engine that is always running, is used only to spawn other engines Hard coded here, should be a config setting
You could also write an inet_spawn, OECGI to spawn the other engines if assigned(spawner_address) else spawner_address=' if len(spawner_address) else spawner_address =\\192.168.0.4:778' end ans=' method=GET' application=SPEC03' username=SPEC03' password=' my_address=spawner_address ; * send in spawner address to initialize. It will be used to figure out the correct ip address returnValue=' Gosub call_spawner
Now Use the spawned engine
if assigned(returnvalue) else returnvalue='
my_address=returnValue
error=returnValue
if len(my_address) else
error=No Engine'end
if error else
Error=CreateEngine(Engine, my_address , Application, 0, 1)if (Error) thenServername='returnendend
Create a queue on that engine. Currently, there is only one queue, the default queue per engine. if error else Error=CreateQueue(Queue, Engine, "", "", Application) if (Error) then CloseEngine(Engine) servername=' return end end if error else funcname=RLIST_JOI' cmd=LIST BOAT NAME' error=CallFunction(Queue, Ans, funcname, cmd, 'HTML') if error then ans=' end end
Close the spawned engine
debug
method=RELEASE'
returnValue='
GoSub Call_Spawner
return ans
call_spawner:
// Connect to the listener to get my own engine.Error=CreateEngine(Engine, spawner_address, Application, 0, 0)if (Error) thenServername='returnend// Create a queue on that engine. Currently, there is only one queue, the default queue per engine.Queuename ='Databasename=applicationerror= CreateQueue(Queue, Engine, QueueName, DatabaseName, UserName, Password)if (Error) thenCloseEngine(Engine)servername='returnenderr=CallFunction(Queue, ReturnValue, 'REVCAPI_SPAWN', method, my_address, application, username, password)if err thenreturnvalue='endCloseQueue(Queue)CloseEngine(Engine)return*
Function REVCAPI_SPAWN(Method, p1, p2, p3, p4, p5, p6)
/*
Purpose:
Let Remote sites create engines
Approach:
Have a master engine listen on a specific port,
Create other engines on a range of ports
Create another engine, return the engine name to the caller.
*/
$insert revcapi_equates
common /revcapi_spawn_common/ Initialized@, Next_Port@, Names@, Engines@, Queues@
if assigned( method ) else method='
if assigned(p1) else p1='
if assigned(p2) else p2='
if assigned(p3) else p3='
if assigned(p4) else p4='
if assigned(p5) else p5='
ans='
err='
if assigned( Initialized@ ) else Initialized@ ='
if Initialized@ else
Init the commonNext_Port@='Names@='Engines@='Queues@='Initialized@=1end
Hard coded in the example, should be in a config file if next_port@ else next_port@=780' external_address=p1 application=p2 username=p3 password=p4 if len(application) else application=@Appid if len(Username) else user=application convert @lower_case to @upper_Case in method equ valid_methods$ to 'GET RELEASE' locate method in valid_methods$ using ' ' setting pos then on pos gosub Get, Release end else ans=' end return ans get: external_address=field(external_address , ':',1) Engine_Port=Next_Port@ Create an OpenEngine
Make the engine locally, but return a reference to it via the ip address used by the caller Error=CreateEngine(Engine, '\\localhost:':Engine_Port, Application, 2, 1) if Error then error := 'Unable to create Engine' end Create a queue on that engine.
if error else
queuename=localhost':Engine_Portdatabasename=applicationerror= CreateQueue(Queue, Engine, QueueName, DatabaseName, UserName, Password)if (Error) thenCloseEngine(Engine)error := ' Bad Queue'endend
if error then
servername='end else
locate Engine_port in names@ using @fm setting pos elsenames@=Insert(names@, pos, 0, 0, engine_port )Engines@=Insert(engines@, pos, 0, 0, engine )Queues@=Insert(queues@, pos, 0, 0, queue )endNext_port@ +=1servername=external_Address : ':' : Engine_Portend
ans=servername : @fm : error
return
release:
error='engine_port=field(external_address, ':', 2)locate Engine_port in names@ using @fm setting pos thenengine=Engines@queue=queues@end elseerror=Unable to find engine ' : external_addressendif error elseEngine='Error=CreateEngine(Engine, '\\localhost:':Engine_Port, Application, 0, 1)Error=CloseEngine(Engine)if error thenerror := ' Close Failed'endendservername='ans=servername : @fm:errorreturn