• 客户端主动关闭,timed_wait


    客户端主动关闭,timed_wait:
    
    
    node2:/root/test#cat t15.py 
    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))
    print s.getsockname()
    print s.getpeername()
    time.sleep(20)
    s.close()
    
    
    node2:/root/test#python t15.py 
    ('192.168.137.3', 52028)
    ('192.168.137.2', 8080)
    
    客户端time_wait:
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          ESTABLISHED 
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          ESTABLISHED 
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          ESTABLISHED 
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:52028         192.168.137.2:8080          TIME_WAIT  
    
    
    服务端干干净净:
    
    tcp        0      0 192.168.137.2:8080          192.168.137.3:52028         ESTABLISHED 
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          192.168.137.3:52028         ESTABLISHED 
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      
    tcp        0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN   
    
  • 相关阅读:
    Linux私房菜——防火墙部分笔记
    ubuntu
    序列求和
    圆的面积
    Fibonacci数列
    JavaScript中定义数组
    C语言中的EOF
    jQuery获取的值去掉px
    jQuery中单引号和双引号的使用
    jQuery报错:Uncaught ReferenceError: $ is not defined
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348512.html
Copyright © 2020-2023  润新知