0

I already know that it is not possible to send raw TCP packet on windows desktops witch mentioned on Microsoft Web Site, But is it possible on new Windows Servers like Windows Server 2019. I don't want to use Pcap or third-party drivers.

Something like this?

      var sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
        sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 8);
        sendSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);

        var s = new IPv4Header
        {
            SrcIpAddress = IPAddress.Parse("127.0.0.99"),
            DesIpAddress = IPAddress.Parse("127.0.0.90"),
            Protocol = 6,
            Length = (ushort)Marshal.SizeOf(typeof(IPv4Header))
        };

        data = s.ToBytes();
BarbaCoder
  • 39
  • 2
  • Does this answer your question? [Send Raw IP packet in C#, everything above the ethernet layer](https://stackoverflow.com/questions/5652226/send-raw-ip-packet-in-c-everything-above-the-ethernet-layer) – Ali Bigdeli Jul 29 '20 at 19:31
  • @AliBigdeli, no it doesn't. They all using third party drivers not socket. Microsoft says it is not possible on Windows Desktop via socket, the question is what about Windows Server? – BarbaCoder Jul 29 '20 at 19:46
  • It is the c# managed library that blocks raw TCP. – jdweng Jul 29 '20 at 20:32

0 Answers0