Пример #1
0
        public override void Close()
        {
            if (_Base != null)
            {
                _Base.Close();
                _Base.Dispose();
                _Base = null;
            }

            _Socket.SendMessage(new CloseStreamMessageRequest(_StreamId));

            BoolMessageResponse ret = _Socket.ReadMessage <BoolMessageResponse>();

            if (!ret.Result)
            {
                throw (new Exception("Error clossing stream"));
            }
        }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="socket">Socket</param>
        /// <param name="stream">Stream</param>
        public TuringStream(TuringSocket socket, Stream stream)
        {
            _Base   = stream;
            _Socket = socket;

            socket.EnqueueMessages = true;

            socket.SendMessage(new OpenStreamMessageRequest());

            OpenStreamMessageResponse ret = socket.ReadMessage <OpenStreamMessageResponse>();

            _StreamId   = ret.Id;
            _CanRead    = ret.CanRead;
            _CanSeek    = ret.CanSeek;
            _CanTimeout = ret.CanTimeout;
            _CanWrite   = ret.CanWrite;
        }