Read about scripting
Find a free port for UDP listening
View list of data type meanings
long GetUdpPort(long First, long Last);
This function finds a free port for use by MUSHclient as a UDP listener. It operates by scanning all open worlds for ports in use by UdpListen. It then works through the range you specify to find one that is not in use.
However this test is only for port used by MUSHclient. There is no guarantee that the port is not in use by another application.
The intention is for plugin writers to use it to find a port in a range (say, 4000 to 4100) which is not in use by another plugin, or the same plugin in another world.
The First and Last arguments are port numbers, inclusive, that you wish to be scanned. eg. GetUdpPort (4000, 4100) would find a port in the range 4000 to 4100 inclusive.
The port numbers must be greater than zero and less than 65535. Also the last port number must be greater than or equal to the first port number.
Available in MUSHclient version 3.66 onwards.
Note GetUdpPort (4000, 4100)
Note (GetUdpPort (4000, 4100))
free_port = GetUdpPort (4000, 4100)
0 : No free port was found in the specified range, or the range was invalid.
non-zero : A port not in use by MUSHclient's UdpListen function.
See Also ...
(UdpListen) Listens for incoming packets using the UDP protocol
(UdpPortList) Returns an array of all the UDP ports in use by this world
(UdpSend) Sends a packet over the network using the UDP protocol
(Help topic: function=GetUdpPort)