예제 #1
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
        /// <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);
                }
            }
        }
예제 #2
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
        /// <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
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
 /// <summary>
 /// Kill ktlstunnel.
 /// </summary>
 public void Terminate()
 {
     tunnel.Terminate();
     transport = null;
 }
예제 #4
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
 /// <summary>
 /// Close the connection to ktlstunnel.
 /// </summary>
 public void Disconnect()
 {
     tunnel.Disconnect();
     transport = null;
 }
예제 #5
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
 /// <summary>
 /// Create an AnpTransport when the tunnel is connected.
 /// </summary>
 public void CreateTransport()
 {
     transport = new AnpTransport(tunnel.EndTls());
     transport.BeginRecv();
 }