{{tag>category:"OpenInsight 32-Bit" author:"Wilhelm Schmitt" author:"Pat McNerthney" author:"Dave Berkovsky" author:"[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]" author:"Bob Orsini" author:"Bob Carten"}} [[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]] ==== 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 [url=http://www.revelation.com/THEWORKS/OIdiscuss.nsf/ef8405490de3608f85256700005245e4/A62FBCAF47D8294085256CDA0044F204?OpenDocument]this one[/url] that should help you. Regards [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] [i]World leaders in all things RevSoft[/i] [img]http://www.sprezzatura.com/zz.gif[/img] ---- === 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 [b] error=createEngine( hEngine,"\\127.0.0.1:888","SYSPROG", CREATE_ENGINE_OPEN_ALWAYS$, 1 )[/b] The program aborts and sends the error [b]SYS1000: Error loading program "CREATEENGINE"[/b]. 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 [url=http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q137/8/90.asp&NoWebContent=1]srvany.exe[/url] 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) then Servername=' return end end // 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) then Servername=' return end // Create a queue on that engine. Currently, there is only one queue, the default queue per engine. Queuename =' Databasename=application error= CreateQueue(Queue, Engine, QueueName, DatabaseName, UserName, Password) if (Error) then CloseEngine(Engine) servername=' return end err=CallFunction(Queue, ReturnValue, 'REVCAPI_SPAWN', method, my_address, application, username, password) if err then returnvalue=' end CloseQueue(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 common Next_Port@=' Names@=' Engines@=' Queues@=' Initialized@=1 end // 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_Port databasename=application error= CreateQueue(Queue, Engine, QueueName, DatabaseName, UserName, Password) if (Error) then CloseEngine(Engine) error := ' Bad Queue' end end if error then servername=' end else locate Engine_port in names@ using @fm setting pos else names@=Insert(names@, pos, 0, 0, engine_port ) Engines@=Insert(engines@, pos, 0, 0, engine ) Queues@=Insert(queues@, pos, 0, 0, queue ) end Next_port@ +=1 servername=external_Address : ':' : Engine_Port end ans=servername : @fm : error return release: error=' engine_port=field(external_address, ':', 2) locate Engine_port in names@ using @fm setting pos then engine=Engines@ queue=queues@ end else error=Unable to find engine ' : external_address end if error else Engine=' Error=CreateEngine(Engine, '\\localhost:':Engine_Port, Application, 0, 1) Error=CloseEngine(Engine) if error then error := ' Close Failed' end end servername=' ans=servername : @fm:error return [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=A7D790068256514285256D1D005035E6|View this thread on the Works forum...]]