亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 15800 | 回復(fù): 3
打印 上一主題 下一主題

linux下tcp超時(shí)如何設(shè)置? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2008-08-14 18:45 |只看該作者 |倒序?yàn)g覽
各位

目前遇到這樣的問題

有一個(gè)socket方式寫的server 和client程序

在windows下  client連接server后 一旦斷開網(wǎng)先  該連接在netstat中看到在1分鐘內(nèi)就會(huì)回收掉

但在linux下  默認(rèn)沒有修改參數(shù)  rehat as3 as4  這種情況下  幾乎要半小時(shí)才回收掉

該超時(shí)參數(shù)如何設(shè)置

已做如下設(shè)置,但沒效果

echo "30">/proc/sys/net/ipv4/tcp_fin_timeout
echo "60">/proc/sys/net/ipv4/tcp_keepalive_time
echo "0">/proc/sys/net/ipv4/tcp_window_scaling
echo "0">/proc/sys/net/ipv4/tcp_sack
echo "0">/proc/sys/net/ipv4/tcp_timestamps

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2008-08-15 09:28 |只看該作者
Use sysctl -A to get a list of available kernel variables
and grep this list for net.ipv4 settings (sysctl -A | grep net.ipv4).
There should exist the following variables:
- net.ipv4.tcp_keepalive_time - time of connection inactivity after which
                                the first keep alive request is sent
- net.ipv4.tcp_keepalive_probes - number of keep alive requests retransmitted
                                  before the connection is considered broken
- net.ipv4.tcp_keepalive_intvl - time interval between keep alive probes

You can manipulate with these settings using the following command:

sysctl -w net.ipv4.tcp_keepalive_time=60 net.ipv4.tcp_keepalive_probes=3 net.ipv4.tcp_keepalive_intvl=10

This sample command changes tcp keepalive timeout to 60 seconds with 3 probes,
10 seconds gap between each. With this, your application will detect dead tcp
connections after 90 seconds (60 + 10 + 10 + 10)


照這個(gè)也沒用  郁悶了

沒人知道?

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2008-08-15 11:42 |只看該作者
問題解決

我現(xiàn)在設(shè)置如下

net.ipv4.tcp_keepalive_time=60
net.ipv4.tcp_keepalive_probes=3
net.ipv4.tcp_keepalive_intvl=10;
net.ipv4.tcp_fin_timeout=30;
net.ipv4.tcp_retries2=5;


起作用的其實(shí)是 net.ipv4.tcp_retries2

keepalive數(shù)值沒用  恢復(fù)到默認(rèn)效果一樣

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2012-05-12 19:16 |只看該作者
這個(gè)是TCP協(xié)議的性質(zhì)決定的啊。。。
客戶端異常終止服務(wù)端不知打就會(huì)一直處在半打開狀態(tài)
只要server端不向client發(fā)送數(shù)據(jù),server就永遠(yuǎn)也不知道斷開了
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP