Exemplo n.º 1
0
        /// <summary>
        /// Send a message on the tunnel.
        /// </summary>
        protected void SendAnpMsg(AnpMsg m)
        {
            AnpTransport transfer = InternalAnpTunnel.GetTransport();

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

            while (transfer.isSending)
            {
                transfer.doXfer();

                if (transfer.isSending)
                {
                    SelectSockets set = new SelectSockets();
                    InternalAnpTunnel.UpdateSelect(set);
                    Block(set);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Send an AnpMsg. This method blocks if a message is currently being
 /// transferred.
 /// </summary>
 /// <param name="msg"></param>
 public void SendMsg(AnpMsg msg)
 {
     Debug.Assert(transport.isReceiving || transport.doneReceiving);
     while (transport.isSending)
     {
         SelectSockets select = new SelectSockets();
         transport.doXfer();
         UpdateSelect(select);
         if (transport.isSending)
         {
             select.Select();
         }
     }
     transport.sendMsg(msg);
     transport.doXfer();
 }
Exemplo n.º 3
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);
        }