Exemplo n.º 1
0
        public Bytes[] PollReadV(int timeout)
        {
            if (tcpSession.CurrentState < TcpState.ESTABLISHED)
            {
                state = State.Closed;
                return(null); // connection closed
            }

            Bytes[] data = tcpSession.PollReadV(TimeSpan.FromMilliseconds(timeout));

            if (data == null)
            {
                if (tcpSession.CurrentState < TcpState.ESTABLISHED)
                {
                    state = State.Closed;
                    return(null); // connection closed
                }
                return(null);     // no more data
            }
            else
            {
                if (tcpSession.AckNow == true)
                {
                    tcpSession.SendPacket(TcpFlags.ACK, false);
                }
                return(data);
            }
        }