コード例 #1
0
        private async void StartRecv()
        {
            while (u != null)
            {
                try
                {
                    var recv = await u.ReceiveAsync().ConfigureAwait(false);

                    tun?.PushPacket(recv.Buffer);
                }
                catch (ObjectDisposedException) { }
                catch (Exception ex)
                {
                    DebugLogger.Log("Error receiving from packet processor: " + ex.ToString());
                }
            }
        }
コード例 #2
0
        private void S_MessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
        {
            var remotePort = args.RemotePort;
            var reader     = args.GetDataReader();

            byte[] b = new byte[reader.UnconsumedBufferLength];
            reader.ReadBytes(b);
            tun.PushPacket(b);
        }
コード例 #3
0
 public void PushPacket(byte[] packet)
 {
     channel.LogDiagnosticMessage("Pushed one packet");
     tun.PushPacket(packet);
 }