1834662 Members
2680 Online
110069 Solutions
New Discussion

Ports already assigned

 
podichin
Advisor

Ports already assigned

Hi All,
I ahve assignes a port range from 64000 to 65000 to my application, (Included in /etc/services), But still i can see some of the dtsessions are using this port range,

Anybody can help me to find out,Why its happening..?

Thanks in advance,
Siju
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: Ports already assigned

Including them in /etc/services does absolutely nothing. Ports in that range are a "free for all" by design. In fact, any ports in the range 49152 to 64K (65536) are referred to as anonymous ports and are "first come; first served".
If it ain't broke, I can fix that.
podichin
Advisor

Re: Ports already assigned

Hi Stephenson,

Thanks for the prompt replay,

Can you please tell me which port range i can use (I want 100o ports,Which is dedicated for my application) and please explain what is meaning of anonymous ports,

Thanks in advance,

Siju
Joseph Loo
Honored Contributor

Re: Ports already assigned

hi siju,

u can also do your part in assigning points:

http://forums1.itrc.hp.com/service/forums/pageList.do?userId=CA1309047&listType=unassigned&forumId=1

regards.

what you do not see does not mean you should not believe
A. Clay Stephenson
Acclaimed Contributor

Re: Ports already assigned

You are not playing by the rules for ports.

http://www.iana.org/assignments/port-numbers

Normally, you choose a singler dedicated port that all client use to coonect and then hand off the connections by forking a new process and using 0 as the port number. The Os then chooses a port from the anonymous range automatically.
If it ain't broke, I can fix that.
podichin
Advisor

Re: Ports already assigned

Hi Stepeherson,

Tanks again for helping to sort it out the problem,

I can set the upper limit of private ports,

Suppose i am setting it as 62000, can i use the remaining port numbers for my applications,

My problem with the application is,Once clients connected to the server with a spcific port number, The next time also, The the same client will try to connect with the same port only,If someother ports already used this port , The connection will fail,

I know the application design is not well, But i am not in a position to change the application, And i need to provide some work aroud also,

Previously, I am using the port range 64401-64469, And application was working fine also,Now i need to add some more ports,(Planning in between 64470-64525), But i can see some of dtsession applicatiosn are using the port in this range,

Can i restrict dtsession for using these ports, I could not understand, if private port numbers were assigned randomly, How my application is working fine with out any problem,

Thanks in advance,

Siju
Muthukumar_5
Honored Contributor

Re: Ports already assigned

Use this:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=437410

Generate /etc/services file with service name and port number so that your application will use it.

hth.
Easy to suggest when don't know about the problem!
A. Clay Stephenson
Acclaimed Contributor

Re: Ports already assigned

Your application was working before purely by accident. You have chosen an extremely poor model for port assignments. The correct was is to register a port with IANA (typically a fairly low number) and use it for all your initial client connections. You then fork() and hand-off a port in the anonymous range and the parent goes back to listening on the dedicated port. That is how you should have coded your application.

However, there is an approach which may work. You can issue an ndd command to define the highest anonymous port and then use a range above that. That should work for.

ndd -set /dev/tcp set_largest_anon_port 64000

Now, you should be able to use the ports above 64000. Your ndd should occur fairly early in the rc scripts so that these ports are not used before your ndd command is executed.

If you put the parameters in /etc/rc.config.d/nddconf, the rc script (/sbin/init.d/net) should automatically take care of it for you.
If it ain't broke, I can fix that.