split example into server and client