首页 获取和修改linux socket最大连接数

获取和修改linux socket最大连接数

举报
开通vip

获取和修改linux socket最大连接数获取和修改linux socket最大连接数 获取和修改linux socket最大连接数 获取linux socket最大连接数 socket连接数的理论值应该和一个进程所能打开的最大文件描述符数相等,所以编写简单程序在Fedora Core Linux下测试得: #include #include #include int main(int argc, char *argv[]) { long val; if((val = sysconf(_SC_OPEN_MAX)) # #...

获取和修改linux socket最大连接数
获取和修改linux socket最大连接数 获取和修改linux socket最大连接数 获取linux socket最大连接数 socket连接数的理论值应该和一个进程所能打开的最大文件描述符数相等,所以编写简单程序在Fedora Core Linux下测试得: #include #include #include int main(int argc, char *argv[]) { long val; if((val = sysconf(_SC_OPEN_MAX)) < 0) { printf("Get the maximum number of files that a process can have open at any time failed\n"); exit(1); } else { printf("The maximum number of files that a process can have open at any time is %ld\n", val); } return 0; } 结果:The maximum number of files that a process can have open at any time is 1024 修改linux socket最大连接数 有两种方法: 1、ulimit -n 5000 把允许最大打开的描述符修改为5000,只对当前终端打开的应用程序有效。 2、修改/etc/security/limits.conf /etc/security/limits.conf # #Each line describes a limit for a user in the form: # # # #Where: # can be: # - an user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # # can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # # can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open files # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # # # #* soft core 0 在该文件中添加以下两行: * soft nofile 5000 * hard nofile 20000 解释: * 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 示该配置对所有用户均有效 soft 表示软连接数 hard 表示硬连接数 nofile 配置是针对描述符的
本文档为【获取和修改linux socket最大连接数】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_731942
暂无简介~
格式:doc
大小:16KB
软件:Word
页数:0
分类:互联网
上传时间:2017-12-13
浏览量:17