code for client and server