internal void WriteData(byte[] buf, int offset, int len)
{
if (this.closed)
{
if (this.failedWithError)
throw new IOException(TLS_ERROR_MESSAGE);
throw new IOException("Sorry, connection has been closed, you cannot write more data");
}
/*
* Protect against known IV attack!
*
* DO NOT REMOVE THIS LINE, EXCEPT YOU KNOW EXACTLY WHAT
* YOU ARE DOING HERE.
*/
SafeWriteMessage(ContentType.application_data, emptybuf, 0, 0);
do
{
/*
* We are only allowed to write fragments up to 2^14 bytes.
*/
int toWrite = System.Math.Min(len, 1 << 14);
SafeWriteMessage(ContentType.application_data, buf, offset, toWrite);
offset += toWrite;
len -= toWrite;
}
while (len > 0);
}