The FTP server has a PassivePortRange configuration statement.  Your app would 
need the same and would, like the FTP server, have to find (bind) an available 
port by trial and error.   As Rob says, PORTANY (port number 0) will cause the 
stack to find an available ephemeral port. 

Regards,
Alan

Alan Altmark
IBM Senior z/VM Engineer and Consultant
1 607 321 7556  (Mobile)
[email protected]

> -----Original Message-----
> From: CMSTSO Pipelines Discussion List <[email protected]> On 
> Behalf Of Donald
> Russell
> Sent: Saturday, June 14, 2025 1:30 PM
> To: [email protected]
> Subject: [EXTERNAL] [CMS-PIPELINES] Obtaining a port for TCPLISTEN
> 
> I have an ephemeral tcpip server that listens on a specified port.
> Obviously I have to make sure that port doesn’t already have a listener in 
> another virtual machine.
> 
> Do you have any suggestions on how the exec can obtain an available port 
> number to use on
> TCPLISTEN. Ideally within a specified range. Similar idea as passive ftp 
> choosing a port between 10000-
> 10100 (or whatever is
> configured)

Reply via email to