This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with listening within a given port range

Old posts that have not been replied to for several years.
Locked
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Help with listening within a given port range

Post by Alchera »

Hi,

I'm using a serving script (for freeware only) with Windrop running behind ICF. The following is all that is a problem.

Code: Select all

set port [listen 0 script null]
I can successfully change the 0 to any port I have setup in ICF ie: 3032.

What I want to do is be able to use any port from 3032 through to 3043.

Can any one assist?

PS: For those Windrop users in need of du, it can be downloaded from here
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Re:Help with listening within a given port range

Post by Alchera »

Code: Select all

# This will return the first port in 'reserved-portrange 
# not currently in use as a listen port.  Will return -1 
# if no port found usable. 
proc FindUsablePort {} { 
  global reserved-portrange 
  foreach {start stop} [split ${reserved-portrange} :] break 
  set dcclist [dcclist]  

  for {set current $start} {$current <= $stop} {incr current} { 
    if {![regexp -- "lstn  *$current" $dcclist]} {return $current} 
  }; return -1 
}
Problem solved! Many thanks to MC_8 for his help. :D
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked