complete code of an chat client