/// <summary>
/// Writes data to the stream.
/// </summary>
/// <param name="buffer">The data to write to the stream.</param>
/// <param name="offset">The location in the buffer to start writing data from.</param>
/// <param name="size">The number of bytes to write to the stream.</param>
/// <exception cref="ArgumentNullException"><paramref name="buffer"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception>
/// <exception cref="ArgumentOutOfRangeException">The specified <paramref name="offset"/> or <paramref name="size"/> exceeds the size of <paramref name="buffer"/>.</exception>
/// <exception cref="IOException">There is a failure while writing to the network.</exception>
public override void Write(byte[] buffer, int offset, int size)
{
if (buffer == null)
{
throw new ArgumentNullException();
}
if (offset < 0 || offset > buffer.Length || size < 0 || size > buffer.Length - offset)
{
throw new ArgumentOutOfRangeException();
}
if (Socket == null)
{
throw new IOException();
}
Socket.Send(buffer, offset, size, SocketFlags.None);
}