UDP::unused_port

Description

Returns an unused UDP port for the specified IP tuple.

Syntax

UDP::unused_port <remote_addr> <remote_port> <local_addr> [<hint_port>]

UDP::unused_port <remote_addr> <remote_port> <local_addr> [<hint_port>]

  • Returns an unused UDP port for the specified IP tuple, using the value of <hint_port> as a starting point if it is supplied. If no appropriate unused local port could be found, 0 is returned.

Examples

when CLIENT_ACCEPTED {
  set port [UDP::unused_port [IP::remote_addr] [UDP::remote_port] [IP::local_addr]]
  UDP::respond "Next unused port: $port"
}