Added working stop function to the tcp server