compeleted code and debug of thread client (linux)