• shutdown(0)和shutdown(1)


    正常的四次挥手:
    
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
    16:40:28.015509 IP 192.168.137.1.50566 > node1.webcache: Flags [S], seq 2511573816, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0
    16:40:28.015554 IP node1.webcache > 192.168.137.1.50566: Flags [S.], seq 1665892250, ack 2511573817, win 1536, options [mss 256,nop,nop,sackOK,nop,wscale 6], length 0
    16:40:28.016825 IP 192.168.137.1.50566 > node1.webcache: Flags [.], ack 1665892251, win 16482, length 0
    
    
    
    
    16:40:38.003254 IP 192.168.137.1.50566 > node1.webcache: Flags [F.], seq 2511573817, ack 1665892251, win 16482, length 0
    16:40:38.003896 IP node1.webcache > 192.168.137.1.50566: Flags [F.], seq 1665892251, ack 2511573818, win 24, length 0
    16:40:38.004336 IP 192.168.137.1.50566 > node1.webcache: Flags [.], ack 1665892252, win 16482, length 0
    
    
    print(socket.SHUT_RDWR)  2
    print(socket.SHUT_RD)    0
    print(socket.SHUT_WR)    1
    
    
    关闭read:
    
    import socket
    import struct
    import time
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.connect(("192.168.137.2",8080))
    s.shutdown(0)
    time.sleep(10)
    
    
    
    
    node1:/root/test#tcpdump -S -i eth1 '((tcp) and  (port 8080) and (host 192.168.137.1))'
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
    
    17:06:50.569831 IP 192.168.137.1.51743 > node1.webcache: Flags [S], seq 2708657781, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0
    17:06:50.569934 IP node1.webcache > 192.168.137.1.51743: Flags [S.], seq 4031762968, ack 2708657782, win 1536, options [mss 256,nop,nop,sackOK,nop,wscale 6], length 0
    17:06:50.570212 IP 192.168.137.1.51743 > node1.webcache: Flags [.], ack 4031762969, win 16482, length 0
    
    shutdown(0)不发送FIN
    
    
    
    
    import socket
    import struct
    import time
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.connect(("192.168.137.2",8080))
    time.sleep(10)
    
    s.shutdown(1)
    print '111111111111111'
    time.sleep(100)
    
    
    shutdown(1)
    
    
    17:08:08.185555 IP 192.168.137.1.51799 > node1.webcache: Flags [F.], seq 1521092233, ack 2941928650, win 16482, length 0
    17:08:08.185692 IP node1.webcache > 192.168.137.1.51799: Flags [F.], seq 2941928650, ack 1521092234, win 24, length 0
    17:08:08.186009 IP 192.168.137.1.51799 > node1.webcache: Flags [.], ack 2941928651, win 16482, length 0
    
  • 相关阅读:
    ArcGIS自定义工具箱-列举损坏的数据源
    ArcGIS自定义工具箱-修复损坏的工作空间
    ArcGIS自定义工具箱-显示地图文档结构
    ArcGIS自定义工具箱-字段合并
    ArcGIS自定义工具箱-字段分割
    ArcGIS自定义工具箱-字段值部分替换
    [转载]ArcGIS Engine 中的多线程使用
    一个WebService Demo
    [GeoServer]Openlayers简单调用
    [ArcEngine]Geotransformation地理变换
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348528.html
Copyright © 2020-2023  润新知