当前位置: 技术问答>linux和unix
能否限定select函数的fd下限?
来源: 互联网 发布时间:2015-05-14
本文导语: 比如我想监听30000-32000, 我只知道能够指定上限32000, 但是这样就把1-32000都监听了, 这样会不会导致效率很低呢? 有没有办法指定下限30000呢? 请教! | The file descriptor limit can be increased using...
比如我想监听30000-32000, 我只知道能够指定上限32000, 但是这样就把1-32000都监听了, 这样会不会导致效率很低呢? 有没有办法指定下限30000呢?
请教!
请教!
|
The file descriptor limit can be increased using the following procedure:
1. Edit /etc/security/limits.conf and add the lines:
* soft nofile 1024
* hard nofile 65535
注意*的地方可以换成应用名。比如oracle/sybase等数据库系统或者notes等对此要求高的可以只给自己设置。
2. Edit /etc/pam.d/login, adding the line:
session required /lib/security/pam_limits.so
3. The system-wide file descriptor limit is set in /proc/sys/fs/file-max. The following command will increase the limit to 65535:
echo 65535 > /proc/sys/fs/file-max
4. Finally, increase the file descriptor limits using:
ulimit -n 8192
5. You may also have to update /etc/sysctl.conf and add/change the fs.file-max setting to:
# Set the maximum number of open files
fs.file-max=65535
Note that you may need to log out and back in again before the changes take effect.
1. Edit /etc/security/limits.conf and add the lines:
* soft nofile 1024
* hard nofile 65535
注意*的地方可以换成应用名。比如oracle/sybase等数据库系统或者notes等对此要求高的可以只给自己设置。
2. Edit /etc/pam.d/login, adding the line:
session required /lib/security/pam_limits.so
3. The system-wide file descriptor limit is set in /proc/sys/fs/file-max. The following command will increase the limit to 65535:
echo 65535 > /proc/sys/fs/file-max
4. Finally, increase the file descriptor limits using:
ulimit -n 8192
5. You may also have to update /etc/sysctl.conf and add/change the fs.file-max setting to:
# Set the maximum number of open files
fs.file-max=65535
Note that you may need to log out and back in again before the changes take effect.
|
没有。用poll吧。
|
select能监听32000?我才知道,是不是现在版本新了改进了?
|
好象只有1024吧!!
|
可以设置,各个系统不一样。