示例#1
0
        /// <summary>
        /// Receives data asynchronously. Returns true if the IO is pending. Returns false if the socket already failed or the data was available in the buffer.
        /// p.Next will only be called if the call completes asynchronously.
        /// </summary>
        public bool ReceiveAsync(AsyncIOArgs p)
        {
            this.CheckDisposed();

            if (!this.IsAlive)
            {
                p.Fail   = true;
                p.Result = null;

                return(false);
            }

            if (this.helper == null)
            {
                this.helper = new AsyncSocketHelper(this);
            }

            return(this.helper.Read(p));
        }
        /// <summary>
        /// Receives data asynchronously. Returns true if the IO is pending. Returns false if the socket already failed or the data was available in the buffer.
        /// p.Next will only be called if the call completes asynchronously.
        /// </summary>
        public bool ReceiveAsync(AsyncIOArgs p)
        {
            this.CheckDisposed();

            if (!this.IsAlive)
            {
                p.Fail = true;
                p.Result = null;

                return false;
            }

            if (this.helper == null)
                this.helper = new AsyncSocketHelper(this);

            return this.helper.Read(p);
        }
示例#3
0
        /// <summary>
        /// Starts recieveing command.
        /// </summary>
        private void BeginRecieveCmd()
        {
            MemoryStream strm = new MemoryStream();

            AsyncSocketHelper.BeginRecieve(m_pSocket, strm, 1024, "\r\n", "\r\n", strm, new SocketCallBack(this.EndRecieveCmd), new SocketActivityCallback(this.SocketActivityCallback));
        }