none
同一个程序在win7和2008r2下面运行结果差异很大 RRS feed

  • 问题

  • 我一个基本的网络通信的程序。基于tcp。我在win7下面抓包传送的数据就无显示基本延迟也就几十上百微秒,但是在2008r2下面抓包分析就发现发送数据包的时间被延迟了10~15ms.高达15毫秒啊,为什么是这样。。

    如果可以,我可以贴代码的,如下图,第一个是我收到数据时间,第二条是我发送的时间。在我本地我测试的时候,我用了cpu定时器来确定时间,发现我发送数据的程序代码是收到数据马上执行了的,期间不过几十微秒。但是在抓包时候就延迟了13ms.

    不能贴图我写文字

    序号 时间 ip1,ip2 协议 其余信息

    358 10.923549000 172.1.x.x 172.2.x.x tcp 100 51212>4901 psh ack seq ack wi

    359 10.935480000 172.2.x.x 172.1.x.x fmtp 254 operational message


    2013年11月28日 14:03

全部回复

  • 您好,

    请问你是使用什么平台开发的这个程序?

    另外,您可以尝试使用Process Monitor来分析比较这个程序运行在Windows 7Windows Server 2008 R2上的区别。

    Process Monitor v3.05

    http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    谢谢。


    Jeremy Wu

    TechNet Community Support

    2013年11月29日 9:06
    版主
  • 谢谢,我在win7 sp1 64位下面用vs2010 开发的win32控制台程序,然后运行在win 2008 r2 sp1 下面。,网络底层也能看见? 我是通过调用dll文件来发送数据的。

    以下是抓包的内容,留意0.008228000 second

    Frame 283: 254 bytes on wire (2032 bits), 254 bytes captured (2032 bits) on interface 0
        Interface id: 0
        WTAP_ENCAP: 1
        Arrival Time: Nov 27, 2013 21:13:59.635796000 中国标准时间
        [Time shift for this packet: 0.000000000 seconds]
        Epoch Time: 1385558039.635796000 seconds
        [Time delta from previous captured frame: 0.008228000 seconds]
        [Time delta from previous displayed frame: 0.008228000 seconds]
        [Time since reference or first frame: 6.187621000 seconds]
        Frame Number: 283
        Frame Length: 254 bytes (2032 bits)
        Capture Length: 254 bytes (2032 bits)
        [Frame is marked: False]
        [Frame is ignored: False]
        [Protocols in frame: eth:ip:tcp:fmtp:data]
        [Coloring Rule Name: Checksum Errors]
        [Coloring Rule String: cdp.checksum_bad==1 || edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1 || sctp.checksum_bad==1 || mstp.checksum_bad==1]
    Ethernet II, Src: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c), Dst: All-HSRP-routers_01 (00:00:0c:07:ac:01)
        Destination: All-HSRP-routers_01 (00:00:0c:07:ac:01)
            Address: All-HSRP-routers_01 (00:00:0c:07:ac:01)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Source: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c)
            Address: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Type: IP (0x0800)
    Internet Protocol Version 4, Src: 172.18.49.113 (172.18.49.113), Dst: 172.18.55.1 (172.18.55.1)
        Version: 4
        Header length: 20 bytes
        Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
            0000 00.. = Differentiated Services Codepoint: Default (0x00)
            .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
        Total Length: 240
        Identification: 0x5de7 (24039)
        Flags: 0x02 (Don't Fragment)
            0... .... = Reserved bit: Not set
            .1.. .... = Don't fragment: Set
            ..0. .... = More fragments: Not set
        Fragment offset: 0
        Time to live: 128
        Protocol: TCP (6)
        Header checksum: 0x0000 [incorrect, should be 0xdb89 (may be caused by "IP checksum offload"?)]
            [Good: False]
            [Bad: True]
                [Expert Info (Error/Checksum): Bad checksum]
                    [Message: Bad checksum]
                    [Severity level: Error]
                    [Group: Checksum]
        Source: 172.18.49.113 (172.18.49.113)
        Destination: 172.18.55.1 (172.18.55.1)
        [Source GeoIP: Unknown]
        [Destination GeoIP: Unknown]
    Transmission Control Protocol, Src Port: 49881 (49881), Dst Port: 51205 (51205), Seq: 1073, Ack: 1652, Len: 200
        Source port: 49881 (49881)
        Destination port: 51205 (51205)
        [Stream index: 2]
        Sequence number: 1073    (relative sequence number)
        [Next sequence number: 1273    (relative sequence number)]
        Acknowledgment number: 1652    (relative ack number)
        Header length: 20 bytes
        Flags: 0x018 (PSH, ACK)
            000. .... .... = Reserved: Not set
            ...0 .... .... = Nonce: Not set
            .... 0... .... = Congestion Window Reduced (CWR): Not set
            .... .0.. .... = ECN-Echo: Not set
            .... ..0. .... = Urgent: Not set
            .... ...1 .... = Acknowledgment: Set
            .... .... 1... = Push: Set
            .... .... .0.. = Reset: Not set
            .... .... ..0. = Syn: Not set
            .... .... ...0 = Fin: Not set
        Window size value: 256
        [Calculated window size: 65536]
        [Window size scaling factor: 256]
        Checksum: 0xc179 [validation disabled]
            [Good Checksum: False]
            [Bad Checksum: False]
        [SEQ/ACK analysis]
            [Bytes in flight: 200]
        [PDU Size: 196]
        TCP segment data (4 bytes)
    Flight Message Transfer Protocol (FMTP), Operational message
        Version: 2
        Reserved: 0
        Length: 50176
        Type: Operational message (1)
        Data (191 bytes)

    
    • 已编辑 returnback 2013年11月30日 14:55 补充图片
    2013年11月29日 15:14
  • 谢谢,我把出问题的抓包数据写在帖子下面了。貌似从网络层次上从上一成到下一层出现了时间过久的问题。

    有线网卡的数据包。所以长度测试为bad.

     0.008228000 seconds]

    这个时间和正确的程序时间不一样。过大。因为我在收到前一个数据后就马上执行发送数据。在我自己检测的代码是马上执行了的。并没有等待8ms左右

    Frame 283: 254 bytes on wire (2032 bits), 254 bytes captured (2032 bits) on interface 0
        Interface id: 0
        WTAP_ENCAP: 1
        Arrival Time: Nov 27, 2013 21:13:59.635796000 中国标准时间
        [Time shift for this packet: 0.000000000 seconds]
        Epoch Time: 1385558039.635796000 seconds
        [Time delta from previous captured frame: 0.008228000 seconds]
        [Time delta from previous displayed frame: 0.008228000 seconds]
        [Time since reference or first frame: 6.187621000 seconds]
        Frame Number: 283
        Frame Length: 254 bytes (2032 bits)
        Capture Length: 254 bytes (2032 bits)
        [Frame is marked: False]
        [Frame is ignored: False]
        [Protocols in frame: eth:ip:tcp:fmtp:data]
        [Coloring Rule Name: Checksum Errors]
        [Coloring Rule String: cdp.checksum_bad==1 || edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1 || sctp.checksum_bad==1 || mstp.checksum_bad==1]
    Ethernet II, Src: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c), Dst: All-HSRP-routers_01 (00:00:0c:07:ac:01)
        Destination: All-HSRP-routers_01 (00:00:0c:07:ac:01)
            Address: All-HSRP-routers_01 (00:00:0c:07:ac:01)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Source: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c)
            Address: HewlettP_be:9b:3c (6c:3b:e5:be:9b:3c)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Type: IP (0x0800)
    Internet Protocol Version 4, Src: 172.18.49.113 (172.18.49.113), Dst: 172.18.55.1 (172.18.55.1)
        Version: 4
        Header length: 20 bytes
        Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
            0000 00.. = Differentiated Services Codepoint: Default (0x00)
            .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
        Total Length: 240
        Identification: 0x5de7 (24039)
        Flags: 0x02 (Don't Fragment)
            0... .... = Reserved bit: Not set
            .1.. .... = Don't fragment: Set
            ..0. .... = More fragments: Not set
        Fragment offset: 0
        Time to live: 128
        Protocol: TCP (6)
        Header checksum: 0x0000 [incorrect, should be 0xdb89 (may be caused by "IP checksum offload"?)]
            [Good: False]
            [Bad: True]
                [Expert Info (Error/Checksum): Bad checksum]
                    [Message: Bad checksum]
                    [Severity level: Error]
                    [Group: Checksum]
        Source: 172.18.49.113 (172.18.49.113)
        Destination: 172.18.55.1 (172.18.55.1)
        [Source GeoIP: Unknown]
        [Destination GeoIP: Unknown]
    Transmission Control Protocol, Src Port: 49881 (49881), Dst Port: 51205 (51205), Seq: 1073, Ack: 1652, Len: 200
        Source port: 49881 (49881)
        Destination port: 51205 (51205)
        [Stream index: 2]
        Sequence number: 1073    (relative sequence number)
        [Next sequence number: 1273    (relative sequence number)]
        Acknowledgment number: 1652    (relative ack number)
        Header length: 20 bytes
        Flags: 0x018 (PSH, ACK)
            000. .... .... = Reserved: Not set
            ...0 .... .... = Nonce: Not set
            .... 0... .... = Congestion Window Reduced (CWR): Not set
            .... .0.. .... = ECN-Echo: Not set
            .... ..0. .... = Urgent: Not set
            .... ...1 .... = Acknowledgment: Set
            .... .... 1... = Push: Set
            .... .... .0.. = Reset: Not set
            .... .... ..0. = Syn: Not set
            .... .... ...0 = Fin: Not set
        Window size value: 256
        [Calculated window size: 65536]
        [Window size scaling factor: 256]
        Checksum: 0xc179 [validation disabled]
            [Good Checksum: False]
            [Bad Checksum: False]
        [SEQ/ACK analysis]
            [Bytes in flight: 200]
        [PDU Size: 196]
        TCP segment data (4 bytes)
    Flight Message Transfer Protocol (FMTP), Operational message
        Version: 2
        Reserved: 0
        Length: 50176
        Type: Operational message (1)
        Data (191 bytes)


    • 已编辑 returnback 2013年11月30日 15:10 修改失误
    2013年11月30日 14:59