Enhancement for CreateRexxPort()
Posted: Mon Jan 15, 2024 8:05 pm
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:
But as this is the case for all programs that can have multiple instances, it would be nice to be able to just call
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
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$
Code: Select all
m_arexxPortName$ = CreateRexxPort("MY_COOL_PORT", True)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