added exception catching for listening socket