RemObjects.InternetPack.Connection.DataSocketReceiveWhatsAvaiable C# (CSharp) Method

DataSocketReceiveWhatsAvaiable() protected method

protected DataSocketReceiveWhatsAvaiable ( Byte buffer, Int32 offset, Int32 size ) : Int32
buffer Byte
offset System.Int32
size System.Int32
return System.Int32
		protected virtual Int32 DataSocketReceiveWhatsAvaiable(Byte[] buffer, Int32 offset, Int32 size)
		{
			this.StartTimeoutTimer();
			try
			{
				Int32 lReadBytes = DataSocket.Receive(buffer, offset, size, SocketFlags.None);

				if (lReadBytes == 0)
					this.DataSocket.Close();

				this.TriggerOnBytesReceived(lReadBytes);
				return lReadBytes;
			}
			catch (ObjectDisposedException)
			{
				this.DataSocket.Close();
				return 0;
			}
			catch (SocketException)
			{
				this.DataSocket.Close();
				return 0;
			}
			finally
			{
				this.StopTimeoutTimer();
			}
		}