示例#1
0
        /// <summary>
        /// Get an AnpMsg. This is a blocking method, unless a message has already
        /// been received.
        /// </summary>
        public AnpMsg GetMsg()
        {
            Debug.Assert(transport.isReceiving || transport.doneReceiving);
            while (!transport.doneReceiving)
            {
                SelectSockets select = new SelectSockets();
                transport.doXfer();
                UpdateSelect(select);
                if (!transport.doneReceiving)
                {
                    select.Select();
                }
            }
            AnpMsg msg = transport.getRecv();

            transport.beginRecv();
            return(msg);
        }
示例#2
0
        /// <summary>
        /// Retrieve a message from the tunnel.
        /// </summary>
        protected AnpMsg GetAnpMsg()
        {
            AnpTransport transfer = InternalAnpTunnel.GetTransport();

            Debug.Assert(transfer.isReceiving || transfer.doneReceiving);
            Debug.Assert(!transfer.isSending);

            while (!transfer.doneReceiving)
            {
                transfer.doXfer();

                if (!transfer.doneReceiving)
                {
                    SelectSockets set = new SelectSockets();
                    InternalAnpTunnel.UpdateSelect(set);
                    Block(set);
                }
            }

            AnpMsg msg = transfer.getRecv();

            transfer.beginRecv();
            return(msg);
        }
示例#3
0
 /// <summary>
 /// Create an AnpTransport when the tunnel is connected.
 /// </summary>
 public void CreateTransport()
 {
     transport = new AnpTransport(tunnel.EndTls());
     transport.beginRecv();
 }