public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state ) {
#if DEBUG
using (GlobalLog.SetThreadKind(ThreadKinds.User | ThreadKinds.Async)) {
#endif
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::BeginWrite " + ValidationHelper.HashString(m_Connection) + ", " + offset.ToString() + ", " + size.ToString());
if(Logging.On)Logging.Enter(Logging.Web, this, "BeginWrite", "");
//
// Basic parameter validation
//
if (!WriteStream) {
throw new NotSupportedException(SR.GetString(SR.net_readonlystream));
}
if (buffer==null) {
throw new ArgumentNullException("buffer");
}
if (offset<0 || offset>buffer.Length) {
throw new ArgumentOutOfRangeException("offset");
}
if (size<0 || size>buffer.Length-offset) {
throw new ArgumentOutOfRangeException("size");
}
IAsyncResult result = InternalWrite(true, buffer, offset, size, callback, state);
if(Logging.On)Logging.Exit(Logging.Web, this, "BeginWrite", result);
return result;
#if DEBUG
}
#endif
}