Initail code for server and client, preperation for multi-threaded