add communication among master, slave, client

still have bugs...