Implemented timeout for tcp listener