title: .net packet sniffing: attempt to create socket causes access error
body: <p>I'm working with the code from <a href="https://stackoverflow.com/questions/1271001/any-good-net-packet-sniffers-around">Any good .net packet sniffers around?</a></p>
  
  <p>Within the project and in a stand-alone, I try to create a socket using the following line:</p>
  
  <pre><code>mainSocket = new Socket(AddressFamily.InterNetwork,
                          SocketType.Raw, ProtocolType.IP);
  </code></pre>
  
  <p>On that line, I immediately get an exception</p>
  
  <pre><code>System.Net.Sockets.SocketException: An attempt was made to access a socket 
  in a way forbidden by its access permissions
  </code></pre>
  
  <p>I don't think this is a problem with the account permissions. I can run Fiddler under this account just fine.</p>
  
  <p>Is this the correct way to open a listener for outgoing packets? If so, what do I need to do to avoid the permission error?</p>
  
  <p><strong>Update</strong>: .net 4.0 Windows 7 Home Premium</p>