TIP 130: Unique DDE server names.

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Author:		Pat Thoyts <[email protected]>
State:		Final
Tcl-Version:	8.5
Created:	23-Mar-2003
Type:		Project
Vote:		Done
Tcl-Ticket:	690354


The dde package server registration code should ensure that the server names are unique. The proposed changes will mean end-user visible changes for some scripts.


This TIP is really driven by Bug 219293 http://sf.net/tracker/?func=detail&aid=219293&group_id=10894&atid=110894

The DDE system actually identifies servers by combination of window ID and a service and topic string identifier. There is nothing to prevent multiple servers having the same string identifiers but it is then a problem to determine which server you need to communicate with.

The tk appname command handles a similar situation by making the name unique during registration by appending a numerical suffix to the suggested name and then returning the name registered as the result of the command.

Proposed Changes

This TIP proposes to use the tk appname unique name algorithm within the DDE server-name registration code. This TIP also proposes a -force option to this command to force the suggested name to be registered. The -force option would then provide the current registration scheme.

Reference Implementation

See the patch attached to SF patch 690354 https://sourceforge.net/tracker/?func=detail&aid=690354&group_id=10894&atid=310894


Firstly the dde servername command may register a different name than that provided to the command. Scripts will need to check the name actually registered by either maintaining the result of this command, or by executing the dde servername command without any arguments. This may impact scripts that assume the supplied argument was in fact the name registered.

Secondly, the name registration code must obtain a list of the dde server names currently registered on the system. It can do this by effectively calling dde services TclEval. In previous versions of the dde package there is a potential for the dde services command to hang in the presence of applications that are not processing messages. However, this issue has been addressed by Bug 707822's resolution.


This document is hereby placed in the public domain.