Socket Listener Limits

Dear All,
I have socket program which listen to many different devices. So I would like to find out what are limitation in order to control the number of devices pointing to it? Any idea?

depends upon the number of ports the user can open
The upper limit is 65536 ports and out of these ports 1-1024 are already reserved.

Dear Sumit,
Currently I listen to only a particular port. So all device will link on that IP and Port. So what is your advice?

there can be operating system limits… which OS are you using?

Dear Jurn,
I am using Cetos 5.5 any comments on that? What limit can the OS have?

the only limitations, is imposed by the number of FD (File Descriptors) a user can open.

How to get this number and increase this number is defined in the below mentioned link: -

http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

Dear Sumit,
Will there be any other limitation such the port or sockets or thread? So what else must I tweak?

nopes…as far as OS goes its only FD’s which needs to be considered

Dear Sumit,
There are few different types of settings which one should I apply and what limit should I set? Currently is 1024.

where do u see 1024 as the limit?

User level FD’s Limits are defined in = vi /etc/security/limits.conf
And
System level FD limits are defined in = vi /etc/sysctl.conf

Please follow this link (http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/) it tells the step by step process to modify the limits for User FD’s and System FD’s

Dear Sumit,
I have logged in as root then I type this ulimit -n and it gives me 1024. So I am trying to understand better the difference between user level and system level. So in my case which to be adjusted? Thank you.

It is always better to define the User level FD’s…Do the following

  1. Login as root
  2. open “vi /etc/security/limits.conf”
  3. edit the above file and add below mentioned 2 lines

<username> soft nofile 100000
<username> hard nofile 100000

<username> - It is the name of the user by which you will be running your application.

  1. Save the file, logout and login again and then type ulimit -n

Dear Sumit,
So what is the limit for settings is it based on my memory? Is 100000 a ok number to set?

8-10 GB can easily handle 100000 sockets but do you think that you will ever reach at 100000 in the whole lifetime of your application?