added tcp server shutdown function