[omniORB] Port re-use policy / Port number after ORB initialisation?

Peter-Rene Steiner peter-rene.steiner@bruker.de
Wed, 13 Jun 2001 15:11:54 +0200


On Thu Jul 27 2000 - 10:31:04 BST 
Sai-Lai Lo wrote:

>>>>> Renzo Tomaselli writes: 
> > I'm somewhat curious to know the reason behind the choice of using the 
> > SO_REUSEADDR option in OmniORB socket handling. 
> > We sometimes find ourselves in trouble because the same port is used by 
> > multiple processes on a single host and they don't know about each other; 
> > even worse, they can be any TCP/IP application. This occurs whenever the 
> > port must be specified manually because some persistent object must be 
> > created (e.g. persistent IOR). This way communications fail (typically 
> > callbacks) in a strange way instead of a friendly "address already in use" 
> > errno and this failure is very hard to track down when the third application 
> > (even a service on NT) is hidden. 
> > Thanks for any clarification, 
>
> SO_REUSEADDR is only used when the application explicitly asked the ORB to 
> use a particular port number. 
> 
> Suppose a server is set to use a particular port all the time. If the 
> server dies and without SO_REUSEADDR, you cannot restart the server 
> immediately because the kernel will have to wait for the tcp timers to 
> expire. 
> 
> Sai-Lai 

Hello all,

while I understand that argument above I would like to suggest to make this behavior
configurable. 

Suppose one wants to enforce a server running on a 'standard' port
(using -ORBiiop_poa_port). With SO_REUSEADDR = 'true' I don't have a chance to 
detect whether that port is already occupied or not - resulting in a server that 
potentially never can be contacted. Otherwise after getting an exception I would 
be able e.g. to increase the desired port number and try again.


Without pre-selecting the port number, is there an easy way to get the port 
after ORB/POA have been initialised? I have studied the actions of 'catior' and 
would like to avoid that 'heavy stuff' in my code.
Didn't find that in the archive; please accept my apologies if I missed something.

Greetings
Peter-Rene Steiner