Implementation of server and client