Opened 16 years ago
Last modified 16 years ago
#29 new defect
How is default port determined if not given in config?
Reported by: | Christoph Mayer | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Foundation | Version: | 0.1.0 |
Keywords: | Cc: |
Description (last modified by )
If no port number is given, tcp and udp currently bind to 41402 (see AribaModule.cpp). If two nodes run locally both choose this port and the latter one will fail to bind. Actually each node could choose a random port (best > 1024) and see which one it can bind to.
Or should all nodes bind to a default if none is given in the config? This would of course not allow multiple nodes one one machine as they would try to bind on the same default port.
Change History (2)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
By the way, I still like the way to hashing the IP address with some Ariba specific modified and getting the port like this:
port = sha1( ip, ARIBA_MOD );
And if the port is already bound by some process or its < 1024, just repeat the hashing
port_2 = sha1( sha1(ip,ARIBA_MOD), ARIBA_MOD );
until we find a free port.
Nodes that want to connect can simply calculate the same hashing sequence until they find the port that we reside on. To limit the connection attempts we would define a max of e.g. 10 attempts to find (1) a free port if we are the node that wants to bind its socket, (2) a port in listening mode that we can connect to if we are the node that wants to connect.
We need some thorough failure handling in case we are the connecting node, as we could hit some other service that is bound to the port and sends us some arbitrary data over that we must detect and handle as not ours.