Tcp communication thread got working