public static bool CheckHandshake(Context context) { if(context.ReceivedByteCount > 8) { var AHandshake = new ClientHandshake(context.Header); // See if our header had the required information if (AHandshake.IsValid()) { // Optionally check Origin and Location if they're set. if (Origin != string.Empty && AHandshake.Origin != "http://" + Origin) { return false; } if (Location != string.Empty && AHandshake.Host != string.Format("{0}:{1}", Location, context.Server.Port)) { return false; } // Generate response handshake for the client var serverShake = GenerateResponseHandshake(AHandshake); // Send the response handshake SendServerHandshake(serverShake, context); return true; } } return false; }