【问题标题】:Why does a packet sent using PCap.NET not fill out the TCP options?为什么使用 PCap.NET 发送的数据包没有填写 TCP 选项?
【发布时间】:2019-07-15 15:06:20
【问题描述】:

我正在尝试使用 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 层时,您可以将 options 属性设置为 None....以与 WinSock 相同的方式发送。任何人都可以为这个问题提供任何解释或建议。提前感谢您的帮助!

【问题讨论】:

    标签: c# network-programming tcpclient winsock pcap.net


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-10-30
      • 1970-01-01
      • 2019-09-30
      • 2012-08-31
      • 2013-12-02
      • 2016-12-24
      • 2012-04-12
      • 1970-01-01
      • 2017-02-26
      相关资源
      最近更新 更多