so, use try/catch when you set the port. the "crash" should be captured by catch. log
lastexception to see what the error was. if it's "already occupied", you move to another port.
which ports are you using anyway? you shouldn't be crashing. http servers normally use
standard ports (80, 8080). if you're using a restricted port (eg, 25), you may be getting a
different error. ports below 1024 are normally reserved for use by root or services running as
root. port 80 is normally reserved for http (443 for https).
you need to find out what the exception is. it should either be in the log or you can trap it
with try/catch and log(lastexception)