コード例 #1
0
        private static ServerHandshake GenerateResponseHandshake(ClientHandshake handshake)
        {
            ServerHandshake responseHandshake = new ServerHandshake();
            responseHandshake.Location = "ws://" + handshake.Host + handshake.ResourcePath;
            responseHandshake.Origin = handshake.Origin;
            responseHandshake.SubProtocol = handshake.SubProtocol;
            responseHandshake.AnswerBytes = GenerateAnswerBytes(handshake.Key1, handshake.Key2, handshake.ChallengeBytes);

            return responseHandshake;
        }
コード例 #2
0
        private static void SendServerHandshake(ServerHandshake handshake, Context context)
        {
            // generate a byte array representation of the handshake including the answer to the challenge
            byte[] handshakeBytes = context.UserContext.Encoding.GetBytes(handshake.ToString());
            Array.Copy(handshake.AnswerBytes, 0, handshakeBytes, handshakeBytes.Length - 16, 16);

            context.UserContext.SendRaw(handshakeBytes);
        }
コード例 #3
0
        private static ServerHandshake GenerateResponseHandshake(ClientHandshake AHandshake)
        {
            ServerHandshake AResponseHandshake = new ServerHandshake();
            AResponseHandshake.Location = "ws://" + AHandshake.Host + AHandshake.ResourcePath;
            AResponseHandshake.Origin = AHandshake.Origin;
            AResponseHandshake.SubProtocol = AHandshake.SubProtocol;
            AResponseHandshake.AnswerBytes = GenerateAnswerBytes(AHandshake.Key1, AHandshake.Key2, AHandshake.ChallengeBytes);

            return AResponseHandshake;
        }