Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Guarantee socket channel name unique

Closed / Rejected1093037fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-12-30 00:43:37
In a dynamic server/monitor app I have many socket 
connections being created and eventually closed. Each 
connection represents some system component process 
that needs to be monitored. I find on Windows that the 
socket string "sockNNN" is often reused. If each 
connection got a unique socketNNN* the managing logic 
could be quite a bit simpler as it could use the socket 
channel handle as representing a unique connection 
instance. I suppose wrap-around at 2^31 would not 
realistically effect the code.  Canvas ID's currently 
follow this sort of uniqueness rule and it is indeed helpful.

Roy
hobbsplain2004-12-30 08:01:17
Logged In: YES 
user_id=72656

There is no problem noted in this bug, and indeed none has
ever been registered regarding the scheme.  On Windows, the
actual value is taken from the pointer location of the
channel structure, so it is guaranteed unique.
royterryplain2004-12-31 02:19:52
Logged In: YES 
user_id=146884

Hey! It's not a bug report it's a request for enhancment. 

Did you notice the discussion of many sockets created and 
closed? I am speaking of the life time of the application not of 
the life time of an open socket. Yes, all open sockets are 
uniquely named; the system would be hoplelessly broken if 
that were not true. However, (the point of this enhancement 
request) an open socket often shares the name of a socket 
that was closed a few seconds ago. This fact can be an 
inconvenience to application logic when that application is 
interested in keeping a robust record socket interactions. 
IOW, the server application deals in information from both 
current and dead/departed socket connections. Hence I am 
lodging a request for enhancement.

What's the point of immediately closing a request for 
enhancement based on one person hurriedly reading and 
misunderstanding it? Sheesh.
hobbsplain2004-12-31 04:07:34
Logged In: YES 
user_id=72656

The response is a lot more clear than the original request
about the reasoning.  Of course, file channels have never
promised uniqueness beyond the lifetime of the channel.

The main point which this remains rejected though is that
you misunderstood the intent and design.  It was never the
intent to make them permanently unique.  The number you see
increasing on unix systems is in fact the same design as on
Tcl.  However, most unix systems just simply incr fds,
whereas it is a pointer (handle) ref on Windows.  In the end
though, there is no guarantee that all unix systems will do
that.  It is simply a rep of what the system 'fd' is.
royterryplain2004-12-31 04:32:36
Logged In: YES 
user_id=146884

rejected because it's not the orginal design!

Wow what an inane way to reason about enhancement 
requests.

I do not misunderstand the original design. I AM ASKING
FOR AN ENHANCEMENT, IOW *NEW THINKING*

I reject your reasoning which is bogus no matter what the 
merit of my request. I can see creative thinking is not wanted 
here as the whole process seems to be owned by one Jeffery 
Hobbs. Sir, you have become arrogant.
dkfplain2005-01-01 23:42:53
Logged In: YES 
user_id=79902

Currently we prefer to expose the underlying ID since that's
at least somewhat useful sometimes under Unix (it gives you
a chance to guess what channel was associated with a
descriptor when you are poking around in /proc, for
example). Well, unless you're messing around with redoing
the standard channels that is. :^)

Given that, and the fact that it is easy for the application
itself to assign unique IDs that are at least as meaningful
(e.g. with the help of an array), I don't feel especially in
favour of this RFE either. Since any external reference can
get mixed up anyway (low-level FDs *are* reused quickly, and
nothing outside the Tcl world would inherently know about
any higher-level stuff) I don't see the advantage in what
you propose, and I do see at least one disadvantage.

I understand that you want to have some reference that lasts
some time past the time that the channel gets closed, but I
do not think that that's something that the core can really
solve for you. You have to understand the persistence
properties yourself (e.g. how long should a zombie socket
last? 0.5 seconds? 30 seconds? 30 minutes? Anything at all
long and the very-high-throughput crowd *will* complain.)
and that pushes it into the higher-level functionality domain.

To sum up: I agree with Jeff, and with two core people
*against* it, this RFE isn't likely to go anywhere. And you
can work around it.
Log in (anonymous is fine) to add a comment.