Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!maytag!csg.uwaterloo.ca!giguere From: giguere@csg.uwaterloo.ca (Eric Giguere) Newsgroups: comp.sys.amiga.programmer Subject: Re: Arexx article in AC Tech Amiga - good but ??? Keywords: ARexx, AC Tech Amiga Message-ID: <1991Mar27.200758.1432@maytag.waterloo.edu> Date: 27 Mar 91 20:07:58 GMT Sender: daemon@maytag.waterloo.edu (Admin) Organization: University of Waterloo Lines: 41 Though I haven't seen the article in question, the original poster is quite correct in that hard-coded port names can lead to problems. It's not a simple problem, though, and it shows up in any system with some kind of public interprocess communication: how do I identify an IPC port? The ARexx resident process (the REXX server) is a good example. Running ARexx programs and host applications NEED to know how to locate it so that they can sent it messages. So the resident process opens two ports ("REXX" and "AREXX") as its "mailboxes". The names are well-known and won't change. This solution works quite nicely because only one copy of the resident process will ever be running at any given time. (It's easy to check, too -- just see if the port you want to allocate has already been allocated...) But then there's the case of programs that can be run multiple times. What should you do then? Let's take a text editor as a classic example. A text editor could be run twice, and each copy can open one or more files for editing. The solution advocated in the Amiga User Interface Style Guide is to open an ARexx port for each open document, with each ARexx port being of the form . where APPNAME is the base application name ("MYEDIT") and NUMBER is a "slot number", a simple integer. The integer is chosen so that the combination of say "MYEDIT.3" is unique from any other port name. Thus a text editor could open port "MYEDIT.1", "MYEDIT.2", etc., as required, re-using slot numbers whenever possible. Of course, now you have a different problem... if you want to talk to a text editor, which port name do you use...? Well ARexx scripts usually don't have to worry because the default host address of an ARexx script will be set to the correct port by the application that starts it. It's your own independent scripts that have to worry... In those situations it may be wise for the application to always open a well-known port for independent communication. -- Eric Giguere giguere@csg.UWaterloo.CA Unlike the cleaning lady, I have to do Windows.