most of the server, extended protocol to handshake with client