added code to communicate with client server