Page 1 of 1

Enhancement for CreateRexxPort()

Posted: Mon Jan 15, 2024 8:05 pm
by mrupp
Hi there

When creating an ARexx port it is needed to evaluate the next free port number (like "MY_COOL_PORT.1"). This is of course possible to do like this:

Code: Select all

Function p_ARexxPortExists(portName$)
	Local checkPort = RunRexxScript("if show(ports,'" .. portName$ .. "') then return 'yes'", True)
	Return(checkPort = "yes")
EndFunction

m_arexxPortName$ = "MY_COOL_PORT"
Local count = 1
Local name$ = m_arexxPortName$ .. "." .. count
While p_ARexxPortExists(name$)
	count = count + 1
	name$ = m_arexxPortName$ .. "." .. count
Wend
CreateRexxPort(name$)
m_arexxPortName$ = name$
But as this is the case for all programs that can have multiple instances, it would be nice to be able to just call

Code: Select all

m_arexxPortName$ = CreateRexxPort("MY_COOL_PORT", True)
and CreateRexxPort() with the 2nd param set to True would evaluate the next free portnumber and return the new portname.

What do you think?

And while you're at it, why not integrate a default function ARexxPortExists(portName$) as well, could always come in quite handy, I think.

Cheers,
Michael

Re: Enhancement for CreateRexxPort()

Posted: Sat Jan 20, 2024 11:20 pm
by airsoftsoftwair
Yes, this should be easy to add. I'll see what I can do.

Re: Enhancement for CreateRexxPort()

Posted: Sun May 18, 2025 6:00 pm
by airsoftsoftwair

Code: Select all

- New [Amiga]: HaveRexxPort() allows you to check if the specified port exists
- New [Amiga]: CreateRexxPort() now supports an optional argument; when set to TRUE, CreateRexxPort() will
  automatically append .1, .2 etc. to the specified port name until it finds a vacant port; the name of
  the port will be returned then