RemObjects.InternetPack.SslConnection.MonoDataSocketSendAsMuchAsPossible C# (CSharp) Метод

MonoDataSocketSendAsMuchAsPossible() приватный Метод

private MonoDataSocketSendAsMuchAsPossible ( Byte buffer, Int32 offset, Int32 size ) : void
buffer Byte
offset System.Int32
size System.Int32
Результат void
		private void MonoDataSocketSendAsMuchAsPossible(Byte[] buffer, Int32 offset, Int32 size)
		{
			try
			{
				IAsyncResult lAsyncResult = this.BeginMonoSslWrite(buffer, offset, size);

				// Manual timeout management
				// Timeout is increased to avoid racing conditions loops
				Int32 lTimeout = this.Timeout * 1000 + MONO_TIMEOUT_SHIFT_PERIOD;

				while (true)
				{
					Int32 lCurrentTimeout = Math.Min(MONO_TIMEOUT_POLL_PERIOD, lTimeout);
					lTimeout -= lCurrentTimeout;

					if (lAsyncResult.AsyncWaitHandle.WaitOne(lCurrentTimeout))
					{
						this.EndMonoSslWrite(lAsyncResult);
						break;
					}

					if (!this.Connected)
					{
						throw new SocketException();
					}

					if (lTimeout == 0)
					{
						// We got a timeout here
						this.DataSocketClose();
						throw new SocketException();
					}
				}
			}
			catch (IOException)
			{
				throw new SocketException();
			}
			finally
			{
				this.StopTimeoutTimer();
			}
		}