Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!uwm.edu!psuvax1!rutgers!cbmvax!higgin From: higgin@cbmvax.commodore.com (Paul Higginbottom - CATS) Newsgroups: comp.sys.amiga.programmer Subject: Re: Waiting for a port in AREXX... Message-ID: <19070@cbmvax.commodore.com> Date: 18 Feb 91 15:23:20 GMT References: <1991Feb16.073956.24406@news.iastate.edu> Reply-To: higgin@cbmvax.commodore.com (Paul Higginbottom - CATS) Organization: Commodore, West Chester, PA Lines: 55 Summary: Expires: Sender: Followup-To: Distribution: Keywords: 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. 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. $ Thanks, $ --George $ This should do the job... /* wait around for a specific port * timeout after 60 seconds... * * Usage: * call waitportexists 'YOURPORT' */ parse arg matchport portfound = 0 do i = 1 to 6 ports = show('p') /* get port list */ do until port='' parse var ports port ports /* snap port off front of list */ /* say 'Matching 'port' and 'matchport'...'*/ if port=matchport then do portfound = 1 leave i end end address command 'wait' 10 end return portfound --------- /* testport.rexx * Try from command line, e.g: * 1> testport foo */ parse arg port options results say 'Waiting for 'port' to exist...' call waitportexists port x = result if x~= 0 then say "it exists!" else say "it doesn't exist"