code for client server communication