为什么使用 PCap.NET 发送的数据包没有填写 TCP 选项?

Why does a packet sent using PCap.NET not fill out the TCP options?

我正在尝试使用 PCap.NET 将 SYN 数据包发送到目的地。当使用 WinSock API 时,我可以在 Wireshark 中看到 TCP 选项......但是当我使用 PCap.NET 构建和发送数据包时,选项不包括在内。这是我用来构建数据包的 TCP 层:

 TcpLayer tcpLayer = new TcpLayer
                {
                    SourcePort = _sourcePort,
                    DestinationPort = _destinationPort,
                    SequenceNumber = _seqNumber,
                    ControlBits = TcpControlBits.Synchronize,
                    Window = _windowSize,
                };

这是使用 WinSock 发送 SYN 的 WireShark ScreenGrab,其中 TCP 选项可见。

这是使用 PCap.NET 发送 SYN 的 Wireshark ScreenGrab,其中 TCP 选项不可见。

据我了解,在构建 Pcap TCP 层时,您可以将选项 属性 设置为 None...我还没有这样做,认为通过将其保留为默认值,选项将以与 WinSock 相同的方式发送。任何人都可以为这个问题提供任何解释或建议。在此先感谢您的帮助!

如果你创建一个新的TcpLayer,你需要设置Options 属性以便在TCP层有选项。 如果您不设置 Options 属性,默认情况下,它将设置为 None.