Ejemplo n.º 1
0
        public virtual async Task ReadBytesAsync(byte[] buffer)
        {
            await WaitForInitialBufferReadyAsync();

            LastReadTime = DateTime.Now;
            SocketDataReader.ReadBytes(buffer);
            InitialBufferLock.Release();
        }
Ejemplo n.º 2
0
        public virtual async Task <uint> LoadAsync(uint amount)
        {
            await WaitForInitialBufferReadyAsync();

            var result = await SocketDataReader.LoadAsync(amount);

            InitialBufferLock.Release();
            return(result);
        }
Ejemplo n.º 3
0
        public virtual async Task <byte> ReadByteAsync()
        {
            await WaitForInitialBufferReadyAsync();

            LastReadTime = DateTime.Now;
            var result = SocketDataReader.ReadByte();

            InitialBufferLock.Release();
            return(result);
        }
Ejemplo n.º 4
0
        public virtual async Task <IBuffer> ReadBufferAsync(uint length)
        {
            await WaitForInitialBufferReadyAsync();

            LastReadTime = DateTime.Now;
            var result = SocketDataReader.ReadBuffer(length);

            InitialBufferLock.Release();
            return(result);
        }
Ejemplo n.º 5
0
        public virtual async Task <string> ReadStringAsync(uint codeUnitCount)
        {
            await WaitForInitialBufferReadyAsync();

            LastReadTime = DateTime.Now;
            var result = SocketDataReader.ReadString(codeUnitCount);

            InitialBufferLock.Release();
            return(result);
        }
Ejemplo n.º 6
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).

                    SubclassDispose();

                    SocketDataReader.Dispose();
                    SocketDataWriter.Dispose();
                    BaseSocket.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }