title: Using TUN driver in windows
body: <p>I have installed the <em>TAP-WIN32 Adapter V9</em> on my Windows 7 machine. I want to use
  TUN to read the IP packets out of the interface. I followed the C# sample from
  <a href="http://www.varsanofiev.com/inside/using_tuntap_under_windows.htm" rel="noreferrer">http://www.varsanofiev.com/inside/using_tuntap_under_windows.htm</a></p>
  
  <p>I modified the code like below</p>
  
  <pre><code>IntPtr ptun = Marshal.AllocHGlobal(8);       
  Marshal.WriteInt32(ptun, 0, 0x0a030001);
  Marshal.WriteInt32(ptun, 4, unchecked((int)0x00ffffFF));
  bool val = DeviceIoControl (ptr, TAP_CONTROL_CODE (5, METHOD_BUFFERED) /*POINT TO POINT */, ptun, 8,ptun, 8, out len, IntPtr.Zero);
  </code></pre>
  
  <p>However, I still don't seem to get IP packets. I ran tcpdump on the other end and
  it complains <em>"Wrong link layer encapsulation"</em>.</p>
  
  <p>Is this the correct way of trying to get IP Packets out of TUN interface?</p>