zoukankan      html  css  js  c++  java
  • net.ipv4.tcp_tw_reuse = 1 重用time_wait

    net.ipv4.tcp_tw_reuse = 1
    
    开启tcp_tw_reuse 
    
    net.ipv4.ip_local_port_range = 50001 50001
    node2:/root/test#python connect1.py 
    response:15
    node2:/root/test#python connect1.py 
    response:15
    node2:/root/test#python connect1.py 
    response:15
    node2:/root/test#python connect1.py 
    response:15
    node2:/root/test#python connect1.py 
    response:15
    
    net.ipv4.tcp_tw_reuse = 1
    node2:/root/test#sysctl -w net.ipv4.ip_local_port_range="50001 50001"
    net.ipv4.ip_local_port_range = 50001 50001
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    tcp        0      0 192.168.137.3:50001         192.168.137.2:8080          TIME_WAIT   
    
    此时可以重用TCP连接
    
    
    关闭tcp_tw_reuse 
    
    net.ipv4.tcp_tw_reuse = 0
    node2:/root/test#sysctl -w net.ipv4.ip_local_port_range="50001 50001"
    net.ipv4.ip_local_port_range = 50001 50001
    
    
    就一直报错 
    node2:/root/test#python connect1.py 
    response:15
    node2:/root/test#python connect1.py 
    Traceback (most recent call last):
      File "connect1.py", line 6, in <module>
        s.connect(("192.168.137.2",8080))
      File "/usr/local/python27/lib/python2.7/socket.py", line 227, in meth
        return getattr(self._sock,name)(*args)
    socket.error: [Errno 99] Cannot assign requested address
    node2:/root/test#python connect1.py 
    Traceback (most recent call last):
      File "connect1.py", line 6, in <module>
        s.connect(("192.168.137.2",8080))
      File "/usr/local/python27/lib/python2.7/socket.py", line 227, in meth
        return getattr(self._sock,name)(*args)
    socket.error: [Errno 99] Cannot assign requested address
    node2:/root/test#
    
    无法重用第一次成功后,后面都报错
  • 相关阅读:
    如何在Grid中做出快捷菜单效果?
    ExtJs FormPanel布局
    wpf 中获取ComboBox中选定的文本值
    delphi中的dbgrid使用
    Delphi修改Access密码,压缩与修复,建立Access数据库文件
    关于OS X系统root账号的激活及密码更改
    Delphi过程函数传递参数的几种方式
    Eclipse里的快捷键
    Delphi封装类到DLL
    Delphi Project 之工程选项(Project Options)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348321.html
Copyright © 2011-2022 走看看