zoukankan      html  css  js  c++  java
  • ping icmp和tcp区别:

    
    ping icmp和tcp区别:
    
    tcpdump -i eth1 '((tcp) and (  host 2.2.2.2)))'
    
    
    
    
    node1:/root/test#cat ping.pl 
    use Net::Ping;
    $p = Net::Ping->new("icmp");
    if ($p->ping('2.2.2.2',20)){
          print '11111111111'
    }
    else{print '222222222'};
    node1:/root/test#time perl ping.pl 
    222222222
    real	0m20.066s
    user	0m0.035s
    sys	0m0.008s
    
    node1:/root# tcpdump -i eth1 '((icmp) and ( host 2.2.2.2))'
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
    17:57:04.217302 IP node1 > 2.2.2.2: ICMP echo request, id 2399, seq 1, length 8
    
    此时发送icmp包,没有重连机制
    
    
    
    发送tcp包:
    use Net::Ping;
    $p = Net::Ping->new("tcp");
    if ($p->ping('2.2.2.2',20)){
          print '11111111111'
    }
    else{print '222222222'};
    
    node1:/root/test#time perl ping.pl 
    222222222
    real	0m20.069s
    user	0m0.032s
    sys	0m0.025s
    
    node1:/root# tcpdump -i eth1 '((tcp) and ( host 2.2.2.2))'
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
    17:59:31.590304 IP node1.50468 > 2.2.2.2.echo: Flags [S], seq 2053712909, win 14600, options [mss 1460,sackOK,TS val 2412269 ecr 0,nop,wscale 6], length 0
    17:59:32.591743 IP node1.50468 > 2.2.2.2.echo: Flags [S], seq 2053712909, win 14600, options [mss 1460,sackOK,TS val 2413270 ecr 0,nop,wscale 6], length 0
    17:59:34.593124 IP node1.50468 > 2.2.2.2.echo: Flags [S], seq 2053712909, win 14600, options [mss 1460,sackOK,TS val 2415271 ecr 0,nop,wscale 6], length 0
    17:59:38.593417 IP node1.50468 > 2.2.2.2.echo: Flags [S], seq 2053712909, win 14600, options [mss 1460,sackOK,TS val 2419272 ecr 0,nop,wscale 6], length 0
    17:59:46.593634 IP node1.50468 > 2.2.2.2.echo: Flags [S], seq 2053712909, win 14600, options [mss 1460,sackOK,TS val 2427272 ecr 0,nop,wscale 6], length 0
    
    
    
    
    
    
  • 相关阅读:
    IceMx.Mvc 我的js MVC 框架 二、视图的数据绑定
    IceMx.Mvc 我的js MVC 框架 一、html代码的分离(视图)
    Android Socket编程基础
    第七次作业
    第六次作业
    第五次作业
    第4次作业
    关于个人项目的总结,最主要是不足
    第二次作业
    微信的优缺点以及发展史
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348553.html
Copyright © 2011-2022 走看看