EncodeRecord() public method

public EncodeRecord ( ContentType contentType, byte recordData ) : byte[]
contentType ContentType
recordData byte
return byte[]
Ejemplo n.º 1
0
        private void InternalBeginWrite(InternalAsyncResult asyncResult)
        {
            try
            {
                // Send the buffer as a TLS record

                lock (write)
                {
                    var record = protocol.EncodeRecord(
                        ContentType.ApplicationData, asyncResult.Buffer, asyncResult.Offset, asyncResult.Count);

                    innerStream.BeginWrite(
                        record, 0, record.Length, InternalWriteCallback, asyncResult);
                }
            }
            catch (Exception ex)
            {
                protocol.SendAlert(ref ex);
                Close();

                throw new IOException("The authentication or decryption has failed.", ex);
            }
        }
Ejemplo n.º 2
0
 private void InternalBeginWrite(InternalAsyncResult asyncResult)
 {
     try
     {
         lock (write)
         {
             byte[] array = protocol.EncodeRecord(ContentType.ApplicationData, asyncResult.Buffer, asyncResult.Offset, asyncResult.Count);
             innerStream.BeginWrite(array, 0, array.Length, InternalWriteCallback, asyncResult);
         }
     }
     catch (TlsException ex)
     {
         protocol.SendAlert(ex.Alert);
         Close();
         throw new IOException("The authentication or decryption has failed.", ex);
         IL_0080 :;
     }
     catch (Exception innerException)
     {
         throw new IOException("IO exception during Write.", innerException);
         IL_0092 :;
     }
 }