sample code for client-slave