private void Client_Commands(object _Data) { Data.InternalNetworkCommand Data = (Data.InternalNetworkCommand)_Data; if (Data.CommandType == Networking.Data.Commands.SSL_Enable) { if (Data.Response == Networking.Data.ResponseCode.Not_Avaliable) { // Not Avaliable } else if (Data.Response == Networking.Data.ResponseCode.Avaliable) { SslStream sslStream = new SslStream(Client.GetStream(), true, new RemoteCertificateValidationCallback(ValidateCert)); StateObject.SSL = sslStream; //new SslStream(Client.GetStream(), true, new RemoteCertificateValidationCallback(ValidateCert), null, EncryptionPolicy.RequireEncryption); SendData(new Data.InternalNetworkCommand(Networking.Data.Commands.SSL_Enable, Networking.Data.ResponseCode.Ready)); } else if (Data.Response == Networking.Data.ResponseCode.Ready) { NetMode = NetworkMode.SSL; SendData(new Data.InternalNetworkCommand(Networking.Data.Commands.SSL_Enable, Networking.Data.ResponseCode.OK)); Fire_ConnectionStateEvent(Networking.Data.Client_ConnectionStatus.Encrypted); } else if (Data.Response == Networking.Data.ResponseCode.Error) { // Error } } else if (Data.CommandType == Networking.Data.Commands.SSL_Dissable) { } else if (Data.CommandType == Networking.Data.Commands.SSL_Active) { } else if (Data.CommandType == Networking.Data.Commands.SetBufferSize) { } else { } }
/// <summary> /// Handels Network Commands /// </summary> /// <param name="_Data">The Data that needs to be handeled</param> /// <param name="node">The client that sent it</param> internal void Server_Commands(object _Data, TCP_ClientNode node) { Data.InternalNetworkCommand Data = (Data.InternalNetworkCommand)_Data; if (Data.CommandType == Networking.Data.Commands.SSL_Enable) { node.EnableSSL(Data.Response); } else if (Data.CommandType == Networking.Data.Commands.SSL_Dissable) { node.DissableSSL(); } else if (Data.CommandType == Networking.Data.Commands.SSL_Active) { } else if (Data.CommandType == Networking.Data.Commands.SetBufferSize) { //Command Not Implemented node.Send(new Data.InternalNetworkCommand(Networking.Data.Commands.SetBufferSize, Networking.Data.ResponseCode.Not_Implemented)); } }