title: Using raw sockets with C#
body: <p>I want to write a port scanner in C# and I can't use SocketType.Raw as raw sockets were taken out from desktop versions of windows. I can't use SharpPcap either or other wrapper for Winpcap as I use PPPoE for internet connection and Winpcap doesn't support PPP devices.</p>
  <p>I need to use a library which implements raw sockets and doesn't rely on winpcap.</p>
  <p>Any ideas? Basically I need to send SYN, receive SYN/ACK or RST but don't send ACK back.</p>
  <p>edit:</p>
  <p>For people who doesn't believe RAW sockets are gone from desktop versions of Windows, see here: <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx</a></p>
  <blockquote>
  <p>On Windows 7, Windows Vista, Windows XP with Service Pack 2 (SP2), and Windows XP with Service Pack 3 (SP3), the ability to send traffic over raw sockets has been restricted in several ways:</p>
  <ul>
  <li>TCP data cannot be sent over raw sockets.</li>
  <li>UDP datagrams with an invalid source address cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped. This change was made to limit the ability of malicious code to create distributed denial-of-service attacks and limits the ability to send spoofed packets (TCP/IP packets with a forged source IP address).</li>
  <li>A call to the <code>bind</code> function with a raw socket for the <code>IPPROTO_TCP</code> protocol is not allowed.<br />
  <strong>Note</strong>  The <code>bind</code> function with a raw socket is allowed for other protocols (<code>IPPROTO_IP</code>, <code>IPPROTO_UDP</code>, or <code>IPPROTO_SCTP</code>, for example).</li>
  </ul>
  </blockquote>