altered example to find port automatically as a test
added option to find port automatically at startup
util for scanning availability of ports