Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!bacchus!mwm From: mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) Newsgroups: comp.sys.amiga.programmer Subject: Re: Waiting for a port in AREXX... Message-ID: Date: 19 Feb 91 00:44:57 GMT References: <1991Feb16.073956.24406@news.iastate.edu> Sender: news@pa.dec.com (News) Organization: Missionaria Phonibalonica Lines: 55 In-Reply-To: skank@iastate.edu's message of 16 Feb 91 07:39:56 GMT In article <1991Feb16.073956.24406@news.iastate.edu> skank@iastate.edu (Skank George L) writes: Hello folks, I'm writing an Arexx program and I'd like to wait for another port to appear before the program proceeds. How do you do this in Arexx, all I can find is WaitForPort. What I'd like is an equivalent Arexx command or procedure, that is, a command or procedure that will pause the execution of the script until the port appears. What would be better is one that would wait for a minute or two then time out if it can't find it. From the manual on WaitForPort, "This is the preferred way to pause while a new ARexx host (or RexxMast) is started. It wait's for 10 seconds (as opposed to the minute or two you asked for), and then exits with an rc of 5 if the port wasn't found. I normally use it like this: if ~show(ports, 'AppPort') then address command 'run application' / * do any setup I need to do here */ address command 'waitforport AppPort' if rc > 0 then do "notify-user Can't start application" exit end /* and we're done */ If you really want to wait a minute (instead of the 10 seconds that the WaitForPort Command does), call it repeatedly, like so: do 6 until rc = 0 address command 'waitforport AppPort' if rc > 0 then do "notify-user Can't start application" exit end You could check the port list yourself and delay, but the above will exit as soon as the port becomes available, instead of at the end of the delay during which the port appears. Additionally, is there a command that will suspend execution of the current Arexx program for X amount of time, like a pause() or sleep() or wait() function? Any help appreciated. Delay() is a direct link to the system Delay() function, taking a single argument of the number of ticks (50ths of a second) to wait. Note that 1.3 Delay() has a nasty bug if you call it with a tick count of 0, so you should avoid that case.