Index: /trunk/FACT++/dim/README_v19.txt
===================================================================
--- /trunk/FACT++/dim/README_v19.txt	(revision 14574)
+++ /trunk/FACT++/dim/README_v19.txt	(revision 14575)
@@ -1,4 +1,4 @@
 
-                    DIM version 19.38 Release Notes
+                    DIM version 19.39 Release Notes
 
 Notes 1 and 2 for Unix Users only
@@ -17,5 +17,12 @@
 		Dns </dev/null >& dns.log &
 
-NOTE 3: The Version Number service provided by servers is now set to 1938.
+NOTE 3: The Version Number service provided by servers is now set to 1939.
+
+04/10/2012
+Changes for version 19.39:
+    - Unfortunately Windows, unlike Linux, does not use LP64 convention for 64 bits, 
+      i.e. the type long is a 32 bit variable (?!?!?!)
+      So created a dim_long type which can always hold a pointer
+ 
 
 09/08/2012
Index: /trunk/FACT++/dim/README_v20.txt
===================================================================
--- /trunk/FACT++/dim/README_v20.txt	(revision 14575)
+++ /trunk/FACT++/dim/README_v20.txt	(revision 14575)
@@ -0,0 +1,757 @@
+
+                    DIM version 20r1 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux, Darwin}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 2001.
+
+07/11/2012
+Changes for version 2001:
+    - First official release containing the Windows 64 bits fix.
+    - The changes in version v19r35 specifying the behaviour when giving a null pointer and size 0 as 
+      "no link" parameters only worked well in "C", not in C++ callbacks - fixed.
+ 
+
+04/10/2012
+Changes for version 19.39:
+    - Unfortunately Windows, unlike Linux, does not use LP64 convention for 64 bits, 
+      i.e. the type long is a 32 bit variable (?!?!?!)
+      So created a dim_long type which can always hold a pointer
+ 
+
+09/08/2012
+Changes for version 19.38:
+    - The timeout used by clients and servers to try to reconnect to a DNS was supposed to be random,
+      to avoid all processes retrying at the same time, but it wasn't - fixed.
+
+
+27/06/2012
+Changes for version 19.37:
+    - DIM DNS crashed for servers with a task name bigger than 80 characters - Fixed.
+
+
+22/06/2012
+Changes for version 19.36:
+    - The internal "DIS_DNS/KILL_SERVERS" command can now be used to pass a user defined exit_code to
+      the servers. The servers will get this exit_code in their exit_handler.
+      Although the exit_code passed to the "DIS_DNS/KILL_SERVERS" command is an integer, only the lower
+      16 bits can be used, i.e. only these bits are passed to the servers.
+
+
+24/05/2012
+Changes for version 19.35:
+    - Fixed the DimInfo() default constructor, now if the default constructor is called, it doesn't cause the 
+      destructor to crash anymore.
+    - Made available to DimInfo, DimStampedInfo, DimUpdatedInfo and DimCurrentInfo the method: 
+      	- void subscribe(char *name, void *nolink, int nolinksize, int time, DimInfoHandler *handler)
+      Like this the default constructor can be called and then this method called later to subscribe
+      whenever needed.
+    - The behaviour of giving a null pointer and size 0 as "no link" parameters was not completely
+      defined. The user could get back either a null pointer or an "invalid" pointer in the callbacks.
+      This is now well-defined: 
+        - If null pointer and size 0 is used at subscribe, the user will get null pointer and size 0 in the callback.
+        - If a negative size is passed at subscribe the callback is not called at all.
+
+
+03/05/2012
+Changes for version 19.34:
+    - Changed back to dna_write_nowait() the message that the server sends to the client when removing
+      a service. This was causing clients not to reconnect ever again when the server removed services.
+      (because the client would get the info much before the DNS, so it would keep trying to reconnect
+      and failing even though the service or even the server didn't exist anymore, without asking the DNS)
+    - Changed the client in order to avoid the behaviour above, i.e. if sending the service request fails it
+      asks the DNS again.
+
+
+23/04/2012
+Changes for version 19.33:
+    - A bug was introduced in v19r30. When trying to retry immediately, a dtq_start_timer(0)
+      was used (like for dna_write). This is not possible because the callback is not protected 
+      by a DIM lock. Fixed. (in v19r32)
+    - Small tidy up in dic.c and protecting the move_to_xxx functions.
+    - When a server received an unsubscribe from the last subscribed service of a client it was closing the
+      connection to the client, this is not good because there could be commands being sent. In any case
+      it should be up to the client to close the connection - Fixed.
+    - dim_send_command now accepts a "-i" argument to send integer data (default is string)
+
+
+30/03/2012
+Changes for version 19.31:
+    - changed dna_write to dna_write_nowait for servers when removing a service and for clients
+      when releasing and subscribing to a service. Dna_write cannot be used for the same connection
+      as dna_write_nowait as it will mingle the packets.
+    - Removed more compiler warnings.
+
+
+14/03/2012
+Changes for version 19.30:
+    - Sometimes when trying to open a connection to a server the client could backoff for too
+      long (10 seconds), now it will retry immediately and then at increasing intervals.
+    - dim_stop() would sometimes not properly stop all threads if a new connection was received
+      in the mean time.
+    - The DimServerDns destructor could crash, fixed.
+    - Removed some compiler warnings about variables set but not used.
+    - Two new functions available:
+	- dim_set_listen_backlog(int size)
+	- int dim_get_listen_backlog()
+    - The DNS will set the listen_backlog to 1024 at startup, but the OS will truncate it to
+      a maximum limit (available in /proc/sys/net/core/somaxconn, linux default=128), 
+      while for servers the constant SOMAXCONN is used.
+
+
+06/02/2012
+Changes for version 19.28:
+    - Added more log messages when a "Write Timeout" occurs to know where it originated.
+    - A server could sometimes not release the connection in case of a "Write Timeout", and
+      then keep on timing out for each message on this connection - fixed.
+
+
+19/01/2012
+Changes for version 19.27:
+    - Updated the DIM Makefiles for MacOSX (Darwin)
+    - Added New possibilities to change DIM timeouts:
+	- 2 New Environment variables:
+	    - DIM_WRITE_TMOUT				(default: 5)
+	    - DIM_KEEPALIVE_TMOUT			(default: 15)
+	- Same functionality as the functions:
+	    - dim_set_write_timeout(int secs)
+	    - int dim_get_write_timeout()
+	    - dim_set_keepalive_timeout(int secs)	//new
+	    - int dim_get_keepalive_timeout()		//new
+	- The functions have precedence over the environment variables.
+    - The server per client exit_handler functionality 
+      (provided by dis_add_client_exit_handler()/dis_set_client_exit_handler())
+      wan not always working correctly (in case of write timeouts) - fixed.
+    - Changed the reporting of "Write Tiemout":
+	- Used to report only: 
+	    - "ERROR: Write Timeout, disconnecting from..."
+	- Now reports:
+	    - "WARNING: Write Timeout, writing to ..."
+	    - If it disconnects: "ERROR: Write Timeout, disconnecting from ..."
+	    - If it reconnects later: "INFO: Re-connected to ..." 
+
+
+14/09/2011
+Changes for version 19.26:
+    - In the notes for version 19.08 there is the following:
+    	- Since version v18r4 where dim_wait() was modified, dim_wait could hang in windows if
+      	  the wake_up event was triggered before dim_wait was called. Could affect smi++. Fixed.
+    - Amasingly enough this seems also to be the case for Linux, dim_wait could hang until there
+      was some new DIM activity, normally some timer firing... Fixed.
+    - The Linux DID now accepts an extra parameter: -dns=<dns_node_name>
+
+01/09/2011
+Changes for version 19.25:
+    - When a Client was releasing a service "at the same time" as the server was deleting the service,
+      The Connection could be released by mistake - fixed.
+    - The SERVICE_LIST service could be updated with an empty string if there were two consecutive 
+      dis_start_serving() - fixed.
+
+
+08/08/2011
+Changes for version 19.24:
+    - The funtion DimInfo::getFormat() never return the correct format of a service, if the first time
+      it was called, the service was not available, i.e. when called inside a "no_link" callback - Fixed.
+    - Deleting the last service of a server or stopping a server could generate "Invalid Service Id"
+      messages from the service that updates DID - Fixed.
+
+
+15/07/2011
+Changes for version 19.23:
+    - The new functions:
+	int DimClient::inCallback()
+	int DimServer::inCallback()
+      Can be used to find out if the function is being called in the context of a DIM callback
+      handler (they return 1 if yes, 0 if no).
+    - There was no way to "remove" an errorHandler or exitHandler in C++.
+      Now the following functions accept 0 as parameter:
+	DimClient::addErrorHandler(0)
+	DimServer::addErrorHandler(0)
+	DimServer::addExitHandler(0)
+	DimServer::addClientExitHandler(0)
+      In order to remove them.
+    - The Windows Visual Studio Manifest file distributed since version v19r19 was wrong, so the latest
+      DIM versions did not work on Windows machines without Visual Studio 8 installed - Fixed.
+
+
+21/06/2011
+Changes for version 19.22:
+    - DIM servers would hang when tring to exit due to "Services already declared", if the user
+      exitHandler() didn't directly call exit (instead tried to exit later in the main program).
+      Fixed.
+    - Servers accept now also 'B' or 'V' as format, they are both equivalent to 'C'.
+    - In Linux when a server printed "Write timeout, disconecting from XXX", it didn't always
+      disconnect properly, so the client would not always reconnect afterwards. Fixed. 
+
+
+31/05/2011
+Changes for version 19.21:
+    - Fixed a bug in DimRpcInfo: the timer for the timeout was started too late and sometimes the
+      RPC data was received in the meantime, so the timer was never stopped. 
+
+
+04/05/2011
+Changes for version 19.20:
+    - Fixed a bug added in v19r18: The <server_name>/SERVICE_LIST was no longer reporting correctly
+      the disappearence of services (by a "-<service_name>" ). Fixed.
+
+
+27/04/2011
+Changes for version 19.19:
+    - Fixed a very very old (horrible) bug in dis.c and dns.c: there was a hardwired malloc(8), 
+      which was only ok for 32 bit machines. It's amazing this didn't bring more trouble...
+
+
+07/04/2011
+Changes for version 19.18:
+    - The standard server service <server_name>/SERVICE_LIST had problems reporting the correct
+      information when used by several clients in paralel - fixed.
+
+
+11/03/2011
+Changes for version 19.17:
+    - The TCPIP "listen" backlog for a server was increased for all servers (including the DNS)
+      from 16 to the constant SOMAXCONN (128 on Linux at the moment, 200 on Windows ?)
+    - After a "fork" the DIM initialization sequence guided by semaphores was not correctly
+      handled, this made the forked children hang and not respond to DIM anymore - fixed.
+
+
+23/02/2011
+Changes for version 19.16:
+    - DimServer::stop() did not correctly clear the ServerName - fixed.
+    - The Linux DID now prints the DNS it is connected to in the title bar.
+
+
+20/12/2010
+Changes for version 19.15:
+    - Still fixing dis_stop_serving():
+        - The DNS sometimes gets a remove service message from a server, after the server has
+          closed the connection, this was not handled properly - fixed.
+        - Fixed yet another detail (variable not cleared) in the thread handling at dis_stop_serving().
+	- dtq.c now clears all timer_queues at dis_stop_serving()
+	- Added some protections in case of closed connections.
+
+
+10/12/2010
+Changes for version 19.14:
+    - Still fixing dis_stop_serving():
+	- Adedd pthread_join in linux to wait for threads to die
+	- the following dis_start_serving() would not reconnect to the DNS if the DNS connection
+          was pending (i.e. the DNS was stopped or restarted)
+
+
+06/12/2010
+Changes for version 19.13:
+    - Fixed a few compiler warnings in dis.c
+    - Added #ifndef PXI around some Windows setPriority calls
+    - dis_stop_serving() did not completely clean-up DIM so that another dis_start_serving()
+      could be done properly after for example a "fork()". Fixed.
+
+
+20/09/2010
+Changes for version 19.12:
+    - Fixed a bug added when removing warnings in v19r10 (dis.c and dns.c).
+
+
+07/06/2010
+Changes for version 19.11:
+    - Added some protections in update_service() in order to try to solve a DIP issue.
+      (related to very frequent updates of the same service in different threads) 
+    - Added the possibility of defining timeouts for:
+	- DimBrowser::getServices 
+	- DimBrowser::getServers 
+	- DimBrowser::getServerServices 
+	- DimBrowser::getServerClients
+    - Added the possibility of retrieving the time a command arrived:
+	- int dis_get_timestamp(int service_id, int *secs, int *millisecs) in C
+	- int DimCommand::getTimestamp() and int DimCommand::getTimestampMillisecs() in C++
+    - Added a "const" keyword to the "char *format" parameter in the constructors of
+	- DimService and DimCommand
+    - Added a call DimCommand::hasNext(), can be used when commands are queued.
+    - Fixed a memory leak when using DimService::setData and then dynamically deleting the
+      DimService 
+
+
+17/02/2010
+Changes for version 19.10:
+    - Fixed a bug in the DNS related to the latest change (browsing for a single service name)
+      The DNS could crash when killing a server.
+    - Removed some compilation warnings 
+
+
+04/01/2010
+Changes for version 19.09:
+    - Created two new functions: dis_set_debug_on() and dis_set_debug_off(), these
+      enable or disable printing a message per service update
+    - Tried to protect against:
+	- a service being deleted from the server while it is being updated
+        - a client unsubscribing from a service while it is being updated.
+    - Optimized the DNS when browsing for a service search pattern without wildcards
+      (i.e. browsing for a single service name) 
+
+
+13/11/2009
+Changes for version 19.08:
+    - Since version v18r4 where dim_wait() was modified, dim_wait could hang in windows if
+      the wake_up event was triggered before dim_wait was called. Could affect smi++.
+      Fixed.
+    - Fixed a compilation bug in dis.c that affected some platforms.
+
+
+30/10/2009
+Changes for version 19.07:
+    - Some more bugs related to being able to publish to more that one DNS fixed.
+
+
+28/10/2009
+Changes for version 19.06:
+    - When opening DNS connections, when the DNS is not there, from a process that is at the 
+      same time a client and a server only one pending connection was used now two separate 
+      ones are created.
+    - Tried to fix a few more problems related to dis_stop_serving...
+
+
+26/10/2009
+Changes for version 19.05:
+    - dis_stop_serving had stopped working in version 19.4. So all servers that undeclared
+      all services and then tried to re-declare new ones would fail (corrupted server name).
+      Affected in particular the DimBridge
+
+
+27/08/2009
+Changes for version 19.04:
+    - Added the following functions:
+	Server part:
+		C - dis_get_n_clients(int service_id)
+		C++ - int DimService::getNClients()
+	Client part (C++ only):
+		DimClient::setNoDataCopy()
+		This will prevent any data copy in the client and the user should make 
+                sure that the data received from DIM is not used outside the callback
+                in order to benefir from this feature.
+    - Fixed the Java DIM Jar file, it was wrong in the previous version.
+
+
+31/07/2009
+Changes for version 19.03:
+    - Removed some more compilation warnings.
+    - Fixed a bug in the DNS. The mechanism for retrieving the "SERVER_LIST" when 
+      some server names were longer that 35 characters was very slow.
+
+
+06/07/2009
+Changes for version 19.02:
+    - Fixed a bug in the server part handling of RPCs, it created a memory leak.
+      It was using a separate thread to handle timeouts and there is no safe way to 
+      kill a thread from outside. Fixed.
+    	- the function dim_stop_thread() is now obsolete.
+    - Added the possibility to change the send and receive buffer sizes:
+	- int dim_set_write_buffer_size(int size)
+	- int dim_get_write_buffer_size()
+	- int dim_set_read_buffer_size(int size)
+	- int dim_get_read_buffer_size()
+      The default (and minimum) is 16384 bytes.
+      These calls should be done before any other DIM calls.
+    - Fixed a bug in the Java DimBrowser class (the format was not returned correctly)
+
+04/05/2009
+Changes for version 19.01:
+    - A server can now publish to more than one DNS.
+      To use an extra DNS:
+	- in "C":
+		long dnsid;
+		char extra_dns[128];
+		...
+		dim_get_env_var("EXTRA_DNS_NODE", extra_dns, sizeof(extra_dns));
+		dnsid = dis_add_dns(extra_dns,0);
+		sprintf(name1,"NewService%d",i);
+		dis_add_service_dns(dnsid, name1, "I", &NewData, sizeof(NewData), 
+					(void *)0, 0 );
+		dis_start_serving_dns(dnsid, "xx_new");
+
+	- in C++:
+		DimServerDns *newDns;
+		char *extraDns = 0;
+		DimService *new_servint;
+		...
+		extraDns = DimUtil::getEnvVar("EXTRA_DNS_NODE");
+		if(extraDns)
+			newDns = new DimServerDns(extraDns, 0, "new_TEST");
+		...
+		if(extraDns)
+			new_servint = new DimService(newDns, "new_TEST/INTVAL",ival);
+
+    - Removed all warnings from DIM sources so that it can be compiled with -Wall -Wextra on Linux
+    - Changed the makefiles so that the default on Linux is now 64 bits.
+	- The flag 32BITS=yes can be added in order to generate 32 bit code
+
+
+26/02/2009
+Changes for version 18.05:
+    - Made the callback for "DIS_DNS/SERVER_LIST" uninterruptible, so that two clients subscribing
+      would not get mixed up answers.
+    - The same for "<server>/SERVICE_LIST"
+    - Tryied to fix a DNS crash, introduced in v18r4 by releasing the connection when "informing clients".
+    - removed some "//" comments in "C"
+
+
+20/02/2009
+Changes for version 18.04:
+    - Changed the dim_wait() mechanism, so that it works for several threads in parallel:
+	- On Linux it was based on POSIX semaphores now it is based on POSIX "condition 
+          variables"
+	- On Windows it was based on "Auto Reset Events" now it uses "Manual Resel "Events"
+    - The DNS should now correctly update the "DIS_DNS/SERVER_LIST" service. It used to report
+      a new server, even when the services already existed and the server was killed by the DNS.
+      (And never report it killed). It also didn't report correctly when a server went out of "ERROR"
+      (this is reported as a "+" as for a new server). 
+
+
+05/02/2009
+Changes for version 18.03:
+    - The list of registered services in a server could get corrupted in some rare cases
+      making the server crash - fixed.
+    - If the DNS couldn't talk to a client it could sometimes hang - fixed.
+    - Java client modifications:
+	- DimUpdatedInfo was not working correctly - fixed in dim_jni.c.
+	- Implemented DimRpcInfo
+	- Changed the DimBroser class to use DimRpcInfo.
+	- Added a jdim.jar file in the jdim/classes directory of the DIM distribution 
+
+
+15/01/2009
+Changes for version 18.02:
+    - Added the following functions:
+	- C++ Client
+		- int DimClient.getServerPid()
+	- Java Client
+		- int DimClient.getServerPid()
+		- String[] DimBrowser.getServers()
+		- String DimBrowser.getServerNode(String server)
+		- int DimBrowser.getServerPid(String server)
+
+
+09/01/2009
+Changes for version 18.01:
+    - Added in the distribution the Visual Studio 8 dlls and manifest. Otherwise
+      it would not work on most PCs.
+
+
+03/12/2008
+Changes for version 18.00:
+    - The Windows execulables and libraries are now built using Visual Studio 8
+    - Some changes added by GSI mainly in the Java Native Interface
+
+
+06/11/2008
+Changes for version 17.12:
+    - Client functionality:
+    	- Added a new function dic_stop(), to close anything related to DIM 
+          for a client
+    	- Added the function dic_get_server_pid(). Similar to dic_get_server(). 
+          Can be executed in a callback to retrieve the pid of the current server
+    - DimBrowser Class:
+        - DimBrowser::getServices() used to create and destroy the DimRpc connection
+          to the Dns every time it was called. This was heavy if called in a loop.
+          Now the connection is maintained until the DimBrowser itself is destroyed.
+	- A new method DimBrowser::getNextServer(char *&server, char *&node, int *pid)
+          has been created. similar to the previous one but returns also the server pid.
+    - DNS
+	- The DNS was still doing some blocking write calls to servers or clients.
+          Now all write calls have a timeout and can not block forever.
+    - Linux DID
+	- The "Subscribe" button was subscribing to services with update rate of 10 seconds.
+	  This was misleading, the users could think the server was calling update_service
+          when it wasn't.
+          Now there are two Subscribe buttons ("on change" or "Update rate of 10 seconds").
+    - DimDridge
+	- Accepts an extra flag "-copy" which provokes an internal copy of the data.
+
+
+08/09/2008
+Changes for version 17.11:
+    - Some DIM Processes, servers or clients could enter a loop taking 100 % CPU 
+      time in some rare occasions, fixed.
+    - Added some protections when removing services in the DimBridge.
+
+
+30/08/2008
+Changes for version 17.10:
+    - Some DIM Processes, servers or clients would not reconnect when the DNS was
+      restarted. Fixed two cause:
+	- Some processes in Linux were stuck reading from the DNS socket
+	- Some others "forgot" to set a timer under very special conditions
+    - Changed some of the DNS debug messages to be more explicit.
+
+
+21/07/2008
+Changes for version 17.09:
+    - DIM error messages were not being flushed when the output was redirected 
+      to a logfile, fixed.
+
+
+18/07/2008
+Changes for version 17.08:
+    - Sometimes a server or a client could do a read on a sockect that had just
+      been closed which left them hanging forever - fixed.
+
+
+01/07/2008
+Changes for version 17.07:
+    - The DimTimer was sometimes not started when the constructor was called
+      with a time argument.
+    - Clients could not connect to more than 1024 servers - fixed.
+      (if the machine allows more than 1024 connections)
+
+
+30/06/2008
+Changes for version 17.06:
+    - Corrected the makefile for Darwin, now the number of accepted connections is 
+      increased to 8192 only for Linux.
+    - Fixed a bug in the DimTimer, it used to accept to be re-started, but then crashed
+      at destruction time if not stopped the same number of times. Now it can not be
+      re-started.
+    - The Dns used to ask servers to re-register at regular intervals when they were not 
+      sending their watchdog messages (i.e. they were in "ERROR", red in DID). Now the
+      DNS only asks once (unless they answer). This could cause the DNS to hang if
+      servers were in ERROR for a long time.
+    - The Dns now accepts a command line parameter: -d to print debug messages.
+    - The clients were not handling properly the case when they could contact the DNS
+      but then they could not contact the server that the DNS gave them (either because
+      of a firewall or because the server run on an inaccessible network). In this case
+      the clients would timeout trying to contact the server for each service and kept
+      asking the DNS the server coordinates over and over again. Now the clients keep
+      a list on unreacheable servers, so they don't try to contact the server for each 
+      service and only ask the DNS again with an increasing interval that goes from 10 
+      seconds to 2 minutes maximum.
+    - The server now issues an error message if the format string is too long.
+    - Linux DID
+        - Removed the command "Kill ALL Servers", it was too dangerous
+	- Now the list of nodes in "View Servers by Node" is in alphabetical order and
+	  in lowercase.
+
+
+30/04/2008
+Changes for version 17.05:
+    - In Linux in some cases a SIGPIPE was generated. Normally the DIM library sets
+      the behaviour of SIGPIPE to ignored, but if another library or main program
+      changes the SIGPIPE behaviour, then the application could exit when the SIGPIPE
+      was generated. Fixed - on Linux now the function send with flag MSG_NOSIGNAL
+      is used in oder to avoid generating SIGPIPE.
+
+
+
+4/04/2008
+Changes for version 17.04:
+    - Sometimes processes (servers or clients) would hang when the DNS was restarted.
+      This was due to a strange (Windows?) feature, by which a connect could succeed
+      after a connection was closed (and reported) on the other side. Fixed.
+
+
+
+27/03/2008
+Changes for version 17.03:
+    - Can now make DID for 64 bits by making DIM using:
+	gmake X64=yes all
+    - Increased the size of the Hash tables for the servers and the DNS.
+
+
+
+20/02/2008
+Changes for version 17.02:
+    - Fixed the Java DimTimer - stop() didn't work
+      Required changing dim_jni.c as well as the java part
+    - Fixed DIM for Darwin - had stopped working
+
+
+
+20/01/2008
+Changes for version 17.01:
+    - The Java API now works on 64 bit machines, Thanks to Joern Adamczewski.
+      Please use:
+	gmake JDIM=yes all
+    - Linux executables are now compiled/linked on slc4 (32 bits).
+    - Big changes in the DimRpcs both client and server part. Tere were bugs
+      related to the handling of timeouts.
+      Unfortunatelly all applications using RPCs need to be re-linked.
+
+
+
+-----------------------------------------------------------------------------------------
+Previous version history:
+
+07/12/2007
+Changes for version 16.14:
+    - Now by default All DIM processes are ready to accept up to 8192 connections, both
+      in Linux and Windows. Although in Linux for this to be effective the machine system 
+      limits must allow more than 1024 descriptors/open files per process.
+    - Fixed a little memory leak in tokenstring.cxx
+    - And a little compilation bug for some platforms in tcpip.c 
+
+
+15/05/2007
+Changes for version 16.13:
+    - If DIM_HOST_NODE is defined when starting up a server, a DIM client will now try 
+      two network interfaces in order to talk to that server and only give up if they both 
+      fail. First it will try the ip name or ip address specified by the server using 
+      DIM_HOST_NODE, if that fails it will try the ip address of the default interface
+      retrieved by the server using gethostname (and gethostbyname).
+      The changes basically affect the case in which the DIM_HOST_NODE given to the servers
+      is specified as IP address instad of an IP name. Otherwise this mechanism was already 
+      working.
+
+
+3/05/2007
+Changes for version 16.12:
+    - The Java version did not exit properly when main() terminated - fixed.
+
+
+25/04/2007
+Changes for version 16.11:
+    - On Linux the timeout to detect a lost connections (unplugged ethernet cable
+      or machine reboot) was too long, around 15 minutes - Fixed.
+      On Linux the KEEPALIVE feature is now used instead of a regular socket write,
+      all other platforms should work as before.
+
+
+21/02/2007
+Changes for version 16.10:
+    - Found a bug in dis_stop_serving: one socket connection was not closed - fixed.
+    - Implemented a new environment variable for the DNS: DIM_DNS_ACCEPTED_NODES
+      Can receive a list on nodes or domains separated by commas.
+      If the DNS receives a connection from a node not in this list, it will
+      reject it and kill the server or client requesting it.
+    - Fixed some C++ warnings.
+
+
+19/01/2007
+Changes for version 16.9:
+    - The modifications done in version 16.8 have introduced a bug:
+	- DIM servers would not behave properly (exit) when receiving a kill command
+          from the DNS (for duplicated services, not allowed host names or manual "kill")
+	  This is now fixed.
+
+
+30/10/2006
+Changes for version 16.8:
+    - Modified dis_stop_serving() and DimServer::stop() to completely stop DIM:
+	- Stop also the DIM threads.
+	- Release all allocated memory
+	- Allow a different port number when re-starting.
+
+
+11/07/2006
+Changes for version 16.7:
+    - Prepared for increasing the number of open connections per process
+      (On Linux still requires changing some parameters and recompiling the Dns)
+    - Fixed one error and several warnings for gcc 4.
+
+
+11/05/2006
+Changes for version 16.6:
+    - Sometimes a server or client would crash while exiting if the DNS was not running.
+      Fixed.
+    - Fixed the reporting of some ERROR messages on Windows (used to report error "0")
+    - Allowed dim_send_command to receive instead of -dns <node_name>
+	-dns <node_name>[:<port_number>]
+
+
+01/05/2006
+Changes for version 16.5:
+    - Big Spring Cleanup. Removed most warnings. Can now be compiled on
+      Windows with Warning Level 3 and on Linux with -Wall
+      (still not working for -ansi -pedantic...)
+    - When trying to access a server in a different network (i.e. not reacheable)
+      a client (for example DID) would take very very long to timeout - fixed.
+    - Added two new sets of functions that allow setting the DIM_DNS_NODE separately
+      for a server and a client in the same process:
+	- int dis_set_dns_node(char *node)
+	- int dis_get_dns_node(char *node)
+	- int dis_set_dns_port(int port)
+	- int dis_get_dns_port()
+
+	- int dic_set_dns_node(char *node)
+	- int dic_get_dns_node(char *node)
+	- int dic_set_dns_port(int port)
+	- int dic_get_dns_port()
+      These routines should be used instead of the equivalent ones starting with "dim_"
+      since these set the same DIM_DNS_NODE/port for both Server and client parts of a 
+      process.
+    - Adapted the C++ equivalents (DimClient::setDnsNode, etc. and DimServer::setDnsNode, 
+      etc.) to use the new routines, so they are now independent.
+      Adapted also the Java equivalents.
+    - Fixed DimBridge to use the new routines.
+    - Fixed a bug in DID that made it crash sometimes at startup (and also when the DNS 
+      restarted)!
+    - Found some very interesting features of DIM:
+        - In a node with two ethernet interfaces (so connected to two networks):
+	    - The DNS will answer to servers and client on both networks, only its server
+              part - DIS_DNS (the one that answers to DID and DimBrowser requests) would
+              in principle answer only to one of the networks (in principle the default
+              interface* but can be changed by setting the environment variable "DIM_HOST_NODE").    
+	    - But, in fact, if the DNS or any server is started with the environment variable 
+              DIM_HOST_NODE set to the interface that is not the default* one. Than both the 
+              DNS (including the server part) and the DIM servers will be accessible from both 
+              networks. For example DID will work fine on both networks.
+            * The command "hostname" will return the name of the default network interface.   
+
+    Note: As a result of inserting new functions the DIM shared library entry points have
+          changed, so all DIM Servers/Clients should be relinked (in particular in Linux).
+
+
+20/04/2006
+Changes for version 16.4:
+    - Optimized the DNS for providing the list or running servers dynamically
+      by subscribing to the service "DIS_DNS/SERVER_LIST"
+
+
+07/04/2006
+Changes for version 16.3:
+    - Upgraded to work on LynxOS Version 4. 
+      - Updated makefile for INTEL platform
+      - Updated some ifdefs based on the existence of __Lynx__
+
+
+10/03/2006
+Changes for version 16.2:
+    - Increased the listen queue. To avoid "Connection Refused" messages from servers
+      or from the DNS.
+
+
+28/02/2006
+Changes for version 16.1:
+    - Fixed the NO_THREADS option for LINUX, it had stopped working.
+    - DimInfo::getData() could return an invalid pointer if called before connecting
+      to the server (or discovering the server did not exist). Fixed 
+      (it now returns 0 in this case).
+
+
+09/11/2005
+Changes for version 16.0:
+    - Consolidated the new timer handling mechanism, should be much more precise.
+    - Fixed the RPC handling. Used to be based on timming assumptions.
+      Now uses a safe protocol to make sure the server is connected before sending 
+      an RPC request.
+    - Included in the distribution some performance measurements and a benchmark 
+      server and client. Sources in src/benchmark executables in /bin for windows
+      and /linux for linux.
+      Usage:
+	benchServer <message_size_in_bytes> <number_of_services>
+	benchClient
+      benchClient will run for a while and print the measurement results. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim/dim/dic.h
===================================================================
--- /trunk/FACT++/dim/dim/dic.h	(revision 14574)
+++ /trunk/FACT++/dim/dim/dic.h	(revision 14575)
@@ -25,12 +25,12 @@
 				    int req_timeout, void *service_address,
 				    int service_size, void (*usr_routine)(void*, void*, int*),
-				    long tag, void *fill_addr, int fill_size) );
+				    dim_long tag, void *fill_addr, int fill_size) );
 _DIM_PROTOE( unsigned dic_info_service_stamped, (char *service_name, int req_type,
 				    int req_timeout, void *service_address,
 				    int service_size, void (*usr_routine)(void*, void*, int*),
-				    long tag, void *fill_addr, int fill_size) );
+				    dim_long tag, void *fill_addr, int fill_size) );
 _DIM_PROTOE( int dic_cmnd_callback,      (char *service_name, void *service_address,
 				    int service_size, void (*usr_routine)(void*, int*),
-				    long tag) );
+				    dim_long tag) );
 _DIM_PROTOE( int dic_cmnd_service,      (char *service_name, void *service_address,
 				    int service_size) );
Index: /trunk/FACT++/dim/dim/dim.h
===================================================================
--- /trunk/FACT++/dim/dim/dim.h	(revision 14574)
+++ /trunk/FACT++/dim/dim/dim.h	(revision 14575)
@@ -14,5 +14,5 @@
 #include "dim_common.h"
 
-#define DIM_VERSION_NUMBER 1938
+#define DIM_VERSION_NUMBER 2001
 
 
@@ -375,5 +375,5 @@
 	int time_left;
 	void (*user_routine)();
-	long tag;
+	dim_long tag;
 } TIMR_ENT;
 
@@ -471,5 +471,5 @@
 	int fill_size;
 	void (*user_routine)();
-	long tag;
+	dim_long tag;
 	TIMR_ENT *timer_ent;
 	int conn_id;
@@ -517,5 +517,5 @@
 _DIM_PROTOE( int dtq_delete,          (int queue_id) );
 _DIM_PROTOE( TIMR_ENT *dtq_add_entry, (int queue_id, int time,
-                                  void (*user_routine)(), long tag) );
+                                  void (*user_routine)(), dim_long tag) );
 _DIM_PROTOE( int dtq_clear_entry,     (TIMR_ENT *entry) );
 _DIM_PROTOE( int dtq_rem_entry,       (int queue_id, TIMR_ENT *entry) );
Index: /trunk/FACT++/dim/dim/dim_common.h
===================================================================
--- /trunk/FACT++/dim/dim/dim_common.h	(revision 14574)
+++ /trunk/FACT++/dim/dim/dim_common.h	(revision 14575)
@@ -43,11 +43,17 @@
 #endif
 
-#ifdef WIN32
+#if defined (_WIN64)
 typedef __int64		longlong;
+typedef longlong dim_long;
+#elif defined(WIN32)
+typedef __int64		longlong;
+typedef long	dim_long;
 #elif defined(__linux__)
 typedef long long int longlong;
+typedef long dim_long;
 #else
 #include <sys/types.h> 
 typedef int64_t	longlong;
+typedef long dim_long;
 #endif
 
@@ -182,5 +188,5 @@
 _DIM_PROTOE( int dim_set_scheduler_class,		(int sched_class) );
 _DIM_PROTOE( int dim_get_scheduler_class,		(int *sched_class) );
-_DIM_PROTOE( long dim_start_thread,    (void(*rout)(void*), void *tag) );
+_DIM_PROTOE( dim_long dim_start_thread,    (void(*rout)(void*), void *tag) );
 _DIM_PROTOE( int dic_set_dns_node,		(char *node) );
 _DIM_PROTOE( int dic_get_dns_node,		(char *node) );
@@ -192,7 +198,7 @@
 _DIM_PROTOE( int dis_get_dns_port,		() );
 _DIM_PROTOE( void dim_stop,				() );
-_DIM_PROTOE( int dim_stop_thread,		(long tid) );
-_DIM_PROTOE( long dis_add_dns,		(char *node, int port) );
-_DIM_PROTOE( long dic_add_dns,		(char *node, int port) );
+_DIM_PROTOE( int dim_stop_thread,		(dim_long tid) );
+_DIM_PROTOE( dim_long dis_add_dns,		(char *node, int port) );
+_DIM_PROTOE( dim_long dic_add_dns,		(char *node, int port) );
 _DIM_PROTOE( int dim_get_env_var,		(char *env_var, char *value, int value_size) );
 _DIM_PROTOE( int dim_set_write_buffer_size,		(int bytes) );
Index: /trunk/FACT++/dim/dim/dis.h
===================================================================
--- /trunk/FACT++/dim/dim/dis.h	(revision 14574)
+++ /trunk/FACT++/dim/dim/dis.h	(revision 14575)
@@ -27,12 +27,12 @@
 _DIM_PROTOE( int dis_start_serving,    (char *task_name) );
 _DIM_PROTOE( void dis_stop_serving,    () );
-_DIM_PROTOE( int dis_get_next_cmnd,    (long *tag, int *buffer, int *size ) );
+_DIM_PROTOE( int dis_get_next_cmnd,    (dim_long *tag, int *buffer, int *size ) );
 _DIM_PROTOE( int dis_get_client,       (char *name ) );
 _DIM_PROTOE( int dis_get_conn_id,      () );
 _DIM_PROTOE( unsigned dis_add_service, (char *service_name, char *service_type,
 				   void *service_address, int service_size,
-				   void (*usr_routine)(void*,void**,int*,int*), long tag) );
+				   void (*usr_routine)(void*,void**,int*,int*), dim_long tag) );
 _DIM_PROTOE( unsigned dis_add_cmnd,        (char *service_name, char *service_type,
-			           void (*usr_routine)(void*,void*,int*), long tag) );
+			           void (*usr_routine)(void*,void*,int*), dim_long tag) );
 _DIM_PROTOE( void dis_add_client_exit_handler,(void (*usr_routine)(int*)) );
 _DIM_PROTOE( void dis_set_client_exit_handler,(int conn_id, int tag) );
@@ -54,11 +54,11 @@
 _DIM_PROTOE( char *dis_get_error_services,	() );
 _DIM_PROTOE( char *dis_get_client_services,	(int conn_id) );
-_DIM_PROTOE( int dis_start_serving_dns,		(long dns_id, char *task_name/*, int *id_list*/) );
-_DIM_PROTOE( void dis_stop_serving_dns,		(long dns_id) );
-_DIM_PROTOE( unsigned dis_add_service_dns,	(long dns_id, char *service_name, char *service_type,
+_DIM_PROTOE( int dis_start_serving_dns,		(dim_long dns_id, char *task_name/*, int *id_list*/) );
+_DIM_PROTOE( void dis_stop_serving_dns,		(dim_long dns_id) );
+_DIM_PROTOE( unsigned dis_add_service_dns,	(dim_long dns_id, char *service_name, char *service_type,
 				   void *service_address, int service_size,
-				   void (*usr_routine)(void*,void**,int*,int*), long tag) );
-_DIM_PROTOE( unsigned dis_add_cmnd_dns,		(long dns_id, char *service_name, char *service_type,
-			       void (*usr_routine)(void*,void*,int*), long tag) );
+				   void (*usr_routine)(void*,void**,int*,int*), dim_long tag) );
+_DIM_PROTOE( unsigned dis_add_cmnd_dns,		(dim_long dns_id, char *service_name, char *service_type,
+			       void (*usr_routine)(void*,void*,int*), dim_long tag) );
 _DIM_PROTOE( int dis_get_n_clients,	(unsigned service_id) );
 _DIM_PROTOE( int dis_get_timestamp,     (unsigned service_id, 
Index: /trunk/FACT++/dim/dim/dis.hxx
===================================================================
--- /trunk/FACT++/dim/dim/dis.hxx	(revision 14574)
+++ /trunk/FACT++/dim/dim/dis.hxx	(revision 14575)
@@ -64,5 +64,5 @@
 	~DimServerDns();
 	void init(const char *node, int port);
-	long getDnsId();
+	dim_long getDnsId();
 	void setName(const char *name);
 	char *getName();
@@ -76,5 +76,5 @@
 	char *itsNode;
 	int itsPort;
-	long itsDnsId;
+	dim_long itsDnsId;
 	char *itsName;
 	int autoStart;
@@ -119,6 +119,6 @@
 	static int setDnsNode(const char *node);
 	static int setDnsNode(const char *node, int port);
-	static long addDns(const char *node, int port);
-	static void stopDns(long dnsid);
+	static dim_long addDns(const char *node, int port);
+	static void stopDns(dim_long dnsid);
 	static char *getDnsNode();
 	static int getDnsPort();
Index: /trunk/FACT++/dim/src/dic.c
===================================================================
--- /trunk/FACT++/dim/src/dic.c	(revision 14574)
+++ /trunk/FACT++/dim/src/dic.c	(revision 14575)
@@ -64,15 +64,15 @@
 				    int req_timeout, void *service_address,
 				    int service_size, void (*usr_routine)(void*,void*,int*),
-				    long tag, void *fill_addr, int fill_size, int stamped) );
+				    dim_long tag, void *fill_addr, int fill_size, int stamped) );
 _DIM_PROTO( int request_command,      (char *service_name, void *service_address,
 				    int service_size, void (*usr_routine)(void*,int*),
-				    long tag, int stamped) );
+				    dim_long tag, int stamped) );
 _DIM_PROTO( DIC_SERVICE *insert_service, (int type, int timeout, char *name,
 				  int *address, int size, void (*routine)(),
-				  long tag, int *fill_addr, int fill_size,
+				  dim_long tag, int *fill_addr, int fill_size,
 				  int pending, int stamped ) );
 _DIM_PROTO( void modify_service, (DIC_SERVICE *servp, int timeout,
 				  int *address, int size, void (*routine)(),
-				  long tag, int *fill_addr, int fill_size, int stamped) );
+				  dim_long tag, int *fill_addr, int fill_size, int stamped) );
 _DIM_PROTO( DIC_SERVICE *locate_command, (char *serv_name) );
 _DIM_PROTO( DIC_SERVICE *locate_pending, (char *serv_name) );
@@ -586,5 +586,5 @@
 
 unsigned dic_info_service( char *serv_name, int req_type, int req_timeout, void *serv_address,
-			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size )
+			   int serv_size, void (*usr_routine)(), dim_long tag, void *fill_addr, int fill_size )
 {
 	unsigned ret;
@@ -598,5 +598,5 @@
 
 unsigned dic_info_service_stamped( char *serv_name, int req_type, int req_timeout, void *serv_address,
-			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size )
+			   int serv_size, void (*usr_routine)(), dim_long tag, void *fill_addr, int fill_size )
 {
 	unsigned ret;
@@ -610,5 +610,5 @@
 
 unsigned request_service( char *serv_name, int req_type, int req_timeout, void *serv_address,
-			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size, int stamped )
+			   int serv_size, void (*usr_routine)(), dim_long tag, void *fill_addr, int fill_size, int stamped )
 {
 	register DIC_SERVICE *servp;
@@ -701,5 +701,5 @@
 
 int dic_cmnd_callback( char *serv_name, void *serv_address, int serv_size, 
-					  void (*usr_routine)(), long tag )
+					  void (*usr_routine)(), dim_long tag )
 {
 	int ret;
@@ -711,5 +711,5 @@
 
 int dic_cmnd_callback_stamped( char *serv_name, void *serv_address, int serv_size, 
-					  void (*usr_routine)(), long tag )
+					  void (*usr_routine)(), dim_long tag )
 {
 	int ret;
@@ -721,5 +721,5 @@
 
 int request_command(char *serv_name, void *serv_address, int serv_size, 
-					  void (*usr_routine)(), long tag, int stamped)
+					  void (*usr_routine)(), dim_long tag, int stamped)
 {
 	int conn_id, ret;
@@ -795,5 +795,5 @@
 
 DIC_SERVICE *insert_service( int type, int timeout, char *name, int *address, int size, 
-							void (*routine)(), long tag, int *fill_addr, int fill_size, 
+							void (*routine)(), dim_long tag, int *fill_addr, int fill_size, 
 							int pending, int stamped)
 {
@@ -869,5 +869,5 @@
 
 void modify_service( DIC_SERVICE *servp, int timeout, int *address, int size, void (*routine)(), 
-			 long tag, int *fill_addr, int fill_size, int stamped)
+			 dim_long tag, int *fill_addr, int fill_size, int stamped)
 {
 	int *fillp;
@@ -1153,5 +1153,5 @@
 int locate_service( DIC_SERVICE *servp )
 {
-	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+	extern int open_dns(dim_long, void (*)(), void (*)(), int, int, int);
 
 	if(!strcmp(servp->serv_name,"DIS_DNS/SERVER_INFO"))
@@ -1517,5 +1517,5 @@
 			if(tmout == 0)
 				tmout = 1;
-			dtq_start_timer(tmout, retry_bad_connection, (long)bad_connp);
+			dtq_start_timer(tmout, retry_bad_connection, (dim_long)bad_connp);
 			if(( servp->type == COMMAND )||( servp->type == ONCE_ONLY ))
 				return(0);
@@ -1987,5 +1987,5 @@
 		id = id_get((void *)itemp, SRC_DIC);
 */
-		dtq_start_timer(0, do_cmnd_callback, (long)itemp);
+		dtq_start_timer(0, do_cmnd_callback, (dim_long)itemp);
 /*
 		(servp->user_routine)( &servp->tag, &ret );
Index: /trunk/FACT++/dim/src/diccpp.cxx
===================================================================
--- /trunk/FACT++/dim/src/diccpp.cxx	(revision 14574)
+++ /trunk/FACT++/dim/src/diccpp.cxx	(revision 14575)
@@ -20,16 +20,28 @@
 	if(DimClient::getNoDataCopy() == 0)
 	{
-		if(!t->itsDataSize)
-		{
-			t->itsData = new char[*size];
-			t->itsDataSize = *size;
-		}
-		else if(t->itsDataSize < *size)
-		{
-			delete[] (char *)(t->itsData);
-			t->itsData = new char[*size];
-			t->itsDataSize = *size;
-		}
-		memcpy(t->itsData, buf, *size);
+		if(*size > 0)
+		{
+			if(!t->itsDataSize)
+			{
+				t->itsData = new char[*size];
+				t->itsDataSize = *size;
+			}
+			else if(t->itsDataSize < *size)
+			{
+				delete[] (char *)(t->itsData);
+				t->itsData = new char[*size];
+				t->itsDataSize = *size;
+			}
+			memcpy(t->itsData, buf, *size);
+		}
+		else if (*size == 0)
+		{
+			if(t->itsDataSize)
+			{
+				delete[] (char *)(t->itsData);
+				t->itsDataSize = 0;
+			}
+			t->itsData = buf;
+		}
 	}
 	else
@@ -83,5 +95,5 @@
 	itsId = dic_info_service(itsName,itsType,itsTime, 0, 0,
 //		user_routine, itsTagId, 
-		user_routine, (long)this, 
+		user_routine, (dim_long)this, 
 		itsNolinkBuf, itsNolinkSize);
 	ENABLE_AST
@@ -134,5 +146,5 @@
 	itsId = dic_info_service(itsName,itsType,itsTime, 0, 0,
 //		user_routine, itsTagId, 
-		user_routine, (long)this, 
+		user_routine, (dim_long)this, 
 		itsNolinkBuf, itsNolinkSize);
 }
@@ -218,5 +230,5 @@
 	itsId = dic_info_service_stamped(itsName,itsType,itsTime, 0, 0,
 //		user_routine, itsTagId, 
-		user_routine, (long)this, 
+		user_routine, (dim_long)this, 
 		itsNolinkBuf, itsNolinkSize);
 	ENABLE_AST
@@ -276,5 +288,5 @@
 	itsId = dic_info_service_stamped(itsName,itsType,itsTime, 0, 0,
 //		user_routine, itsTagId, 
-		user_routine, (long)this, 
+		user_routine, (dim_long)this, 
 		itsNolinkBuf, itsNolinkSize);
 	ENABLE_AST
@@ -332,16 +344,28 @@
 //	t = (DimCurrentInfo *)id_get_ptr(id, SRC_DIC);
 	t = * (DimCurrentInfo **)tagp;
-	if(!t->itsDataSize)
-	{
-		t->itsData = new char[*size];
-		t->itsDataSize = *size;
-	}
-	else if(t->itsDataSize < *size)
-	{
-		delete[] (char *)(t->itsData);
-		t->itsData = new char[*size];
-		t->itsDataSize = *size;
-	}
-	memcpy(t->itsData, buf, *size);
+	if(*size > 0)
+	{
+		if(!t->itsDataSize)
+		{
+			t->itsData = new char[*size];
+			t->itsDataSize = *size;
+		}
+		else if(t->itsDataSize < *size)
+		{
+			delete[] (char *)(t->itsData);
+			t->itsData = new char[*size];
+			t->itsDataSize = *size;
+		}
+		memcpy(t->itsData, buf, *size);
+	}
+	else if (*size == 0)
+	{
+		if(t->itsDataSize)
+		{
+			delete[] (char *)(t->itsData);
+			t->itsDataSize = 0;
+		}
+		t->itsData = buf;
+	}
 	t->itsSize = *size;
 	t->wakeUp = 1;
@@ -390,5 +414,5 @@
 	dic_info_service(itsName,ONCE_ONLY,timeout, 0, 0,
 //		data_user_routine, itsTagId, 
-		data_user_routine, (long)this, 
+		data_user_routine, (dim_long)this, 
 		itsNolinkBuf, itsNolinkSize);
 }
@@ -464,5 +488,5 @@
 		dic_cmnd_callback(name, data, datasize, 
 //			cmnd_done, id);
-			cmnd_done, (long)this);
+			cmnd_done, (dim_long)this);
 		while(!wakeUp)
 		{
@@ -503,14 +527,25 @@
 	if(DimClient::getNoDataCopy() == 0)
 	{
-		if(!t->itsDataSize)
-		{
-			t->itsData = new char[size];
-			t->itsDataSize = size;
-		}
-		else if(t->itsDataSize < size)
-		{
-			delete[] (char *)(t->itsData);
-			t->itsData = new char[size];
-			t->itsDataSize = size;
+		if(size > 0)
+		{
+			if(!t->itsDataSize)
+			{
+				t->itsData = new char[size];
+				t->itsDataSize = size;
+			}
+			else if(t->itsDataSize < size)
+			{
+				delete[] (char *)(t->itsData);
+				t->itsData = new char[size];
+				t->itsDataSize = size;
+			}
+		}
+		else if (size == 0)
+		{
+			if(t->itsDataSize)
+			{
+				delete[] (char *)(t->itsData);
+				t->itsDataSize = 0;
+			}
 		}
 	}
@@ -525,5 +560,10 @@
 //printf("DIM RPC: Stopped Timer, Data Received for %s\n", t->getName());
 		if(DimClient::getNoDataCopy() == 0)
-			memcpy(t->itsData, buf, size);
+		{
+			if(size > 0)
+				memcpy(t->itsData, buf, size);
+			else
+				t->itsData = buf;
+		}
 		else
 			t->itsData = buf;
@@ -557,14 +597,25 @@
 	if(DimClient::getNoDataCopy() == 0)
 	{
-		if(!itsDataSize)
-		{
-			itsData = new char[size];
-			itsDataSize = size;
-		}
-		else if(itsDataSize < size)
-		{
-			delete[] (char *)(itsData);
-			itsData = new char[size];
-			itsDataSize = size;
+		if(size > 0)
+		{
+			if(!itsDataSize)
+			{
+				itsData = new char[size];
+				itsDataSize = size;
+			}
+			else if(itsDataSize < size)
+			{
+				delete[] (char *)(itsData);
+				itsData = new char[size];
+				itsDataSize = size;
+			}
+		}
+		else if (size == 0)
+		{
+			if(itsDataSize)
+			{
+				delete[] (char *)(itsData);
+				itsDataSize = 0;
+			}
 		}
 	}
@@ -572,5 +623,10 @@
 	{
 		if(DimClient::getNoDataCopy() == 0)
-			memcpy(itsData, buf, size);
+		{
+			if(size > 0)
+				memcpy(itsData, buf, size);
+			else
+				itsData = buf;
+		}
 		else
 			itsData = buf;
@@ -653,5 +709,5 @@
 				0, 0,
 //				rpc_user_routine, itsTagId, 
-				rpc_user_routine, (long)itsHandler, 
+				rpc_user_routine, (dim_long)itsHandler, 
 				itsNolinkBuf, itsNolinkSize);
 //			dim_usleep(200000);
@@ -704,5 +760,5 @@
 //printf("DIM RPC: Stopped Timer, Command failed for %s\n", itsName);
 //		rpc_user_routine((int *)&itsTagId, itsNolinkBuf, &itsNolinkSize);
-		rpc_user_routine((long *)&itsHandler, itsNolinkBuf, &itsNolinkSize);
+		rpc_user_routine((dim_long *)&itsHandler, itsNolinkBuf, &itsNolinkSize);
 	}
 /*
Index: /trunk/FACT++/dim/src/dim_jni.c
===================================================================
--- /trunk/FACT++/dim/src/dim_jni.c	(revision 14574)
+++ /trunk/FACT++/dim/src/dim_jni.c	(revision 14575)
@@ -417,5 +417,5 @@
   int doit;
 
-  DBGe(dim_Dbg_SEND_CALLBACK) printf("DimJNI: client SEND_CALLBACK status %08lx:%d\n", (unsigned long)_status, *_status);
+  DBGe(dim_Dbg_SEND_CALLBACK) printf("DimJNI: client SEND_CALLBACK status %08lx:%d\n", (dim_long)_status, *_status);
 
   doit = dim_jni_attachThread(&env);
@@ -443,5 +443,5 @@
   jobject theSendSynchronizer;
   
-  extern int request_command(char *, void *, int , void (*)(), long, int);
+  extern int request_command(char *, void *, int , void (*)(), dim_long, int);
 
   const char* cmnd = (*env)->GetStringUTFChars(env, name, 0);
@@ -471,5 +471,5 @@
 
   // Send the request
-  ret = request_command((char *)cmnd, data_address, data_size, callback_funct, (long)callback_param, stamped);
+  ret = request_command((char *)cmnd, data_address, data_size, callback_funct, (dim_long)callback_param, stamped);
   DBGx(dim_Dbg_SEND_NATIVE) printf("DimJNI: Client.Send(%s,(%s) 0x%x) returns %d \n", cmnd, send_data_format, * (int*) data_address, ret);
 
@@ -868,5 +868,5 @@
 void info_service_callback(jobject* _theDataDecoder, void* dataAddress, int* _dataSize)
 {
-	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK(data: %08lx(%08x))\n", (unsigned long) dataAddress, *_dataSize);
+	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK(data: %08lx(%08x))\n", (dim_long) dataAddress, *_dataSize);
 
   decodeData(_theDataDecoder, dataAddress, _dataSize, 0);
@@ -877,5 +877,5 @@
 void info_service_callback_with_cleanup(jobject* _theDataDecoder, void* dataAddress, int* _dataSize)
 {
-	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK/ONCE_ONLY(data: %08lx(%08x))\n", (unsigned long)dataAddress, *_dataSize);
+	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK/ONCE_ONLY(data: %08lx(%08x))\n", (dim_long)dataAddress, *_dataSize);
 
   decodeData(_theDataDecoder, dataAddress, _dataSize, 1);
@@ -986,5 +986,5 @@
   const char* info = (*env)->GetStringUTFChars(env, name, 0);
   extern unsigned request_service(char *, int, int , void *, int , void (*)(),
-				    long, void *, int, int);
+				    dim_long, void *, int, int);
 
 //  DBGe(dim_Dbg_INFO_SERVICE); /* trap only, we report on exit */
@@ -1009,6 +1009,6 @@
 
 
-  ret = request_service((char *)info, service_type, timeout, 0, 0, callback_function, (long)callback_param, &no_link, 0, stamped);
-  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: client infoService(%s, DataDecoder@0x%08lx, mode=%d, timeout=%d ) returns %d\n", info, (unsigned long)theNativeDataDecoder, mode, timeout, ret);
+  ret = request_service((char *)info, service_type, timeout, 0, 0, callback_function, (dim_long)callback_param, &no_link, 0, stamped);
+  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: client infoService(%s, DataDecoder@0x%08lx, mode=%d, timeout=%d ) returns %d\n", info, (dim_long)theNativeDataDecoder, mode, timeout, ret);
   (*env)->ReleaseStringUTFChars(env, name, info);
 
@@ -1062,5 +1062,5 @@
 
 //printf("Stopping timer %08x %08X\n", callback_param, aDimTimer);
-  ret = dtq_stop_timer((long)callback_param);
+  ret = dtq_stop_timer((dim_long)callback_param);
  //printf("ret = %d\n", ret);
 
@@ -1263,5 +1263,5 @@
 //		printf("data address = %x, data size = %d\n",*address, *size);
 	}
-	DBGx(dim_Dbg_SERVICE_CALLBACK) printf("DimJNI: server_SERVICE_CALLBACK(dataEncoder=%08lx)\n        ==>    data: %08lx size %08x\n", (unsigned long)dataEncoder, (unsigned long) *address, *size); 
+	DBGx(dim_Dbg_SERVICE_CALLBACK) printf("DimJNI: server_SERVICE_CALLBACK(dataEncoder=%08lx)\n        ==>    data: %08lx size %08x\n", (dim_long)dataEncoder, (dim_long) *address, *size); 
 
 	if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
@@ -1409,5 +1409,5 @@
 	sid = dis_add_service(serviceNameUTF, serviceTypeUTF, 0, 0, server_getInfo_callback, dataEncoder);
 
-	DBGx(dim_Dbg_ADD_SERVICE) printf("DimJNI: Server.addService(%s,%s, @%08lx)=%d\n",serviceNameUTF, serviceTypeUTF, (unsigned long)dataEncoder, sid);
+	DBGx(dim_Dbg_ADD_SERVICE) printf("DimJNI: Server.addService(%s,%s, @%08lx)=%d\n",serviceNameUTF, serviceTypeUTF, (dim_long)dataEncoder, sid);
 
 	(*env)->ReleaseStringUTFChars(env, serviceName, serviceNameUTF);
@@ -1420,5 +1420,5 @@
 {
 
-	DBGe(dim_Dbg_CMND_CALLBACK) printf("DimJNI: server CMND_CALLBACK(data: %08lx(%08x))\n", (unsigned long) dataAddress, *_dataSize);
+	DBGe(dim_Dbg_CMND_CALLBACK) printf("DimJNI: server CMND_CALLBACK(data: %08lx(%08x))\n", (dim_long) dataAddress, *_dataSize);
 
   decodeData(_theDataDecoder, dataAddress, _dataSize, 0);
@@ -1443,5 +1443,5 @@
 	sid = dis_add_cmnd(serviceNameUTF, serviceTypeUTF, server_cmnd_callback, dataDecoder);
 
-	DBGx(dim_Dbg_ADD_CMND) printf("DimJNI: Server.addCmnd(%s,%s, @%08lx) = %d\n",serviceNameUTF, serviceTypeUTF, (unsigned long) dataDecoder, sid);
+	DBGx(dim_Dbg_ADD_CMND) printf("DimJNI: Server.addCmnd(%s,%s, @%08lx) = %d\n",serviceNameUTF, serviceTypeUTF, (dim_long) dataDecoder, sid);
 
 	(*env)->ReleaseStringUTFChars(env, serviceName, serviceNameUTF);
@@ -2396,6 +2396,6 @@
 	descriptor->maxEntries = maxEntries;
 
-	DBGx(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.newObjectDescriptor %08lx\n", (long)descriptor);
-	return (long) descriptor;
+	DBGx(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.newObjectDescriptor %08lx\n", (dim_long)descriptor);
+	return (dim_long) descriptor;
 }
 
@@ -2432,5 +2432,5 @@
 	// TODO throw an error if there is no such FieldID
 
-	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.addFieldToObjectDescriptor %08lx Field %s Type %s\n", (long) desc, name, type);
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.addFieldToObjectDescriptor %08lx Field %s Type %s\n", (dim_long) desc, name, type);
 	// TODO: if(entry==NULL) throw out-of-memory exception, set length to 0
 
@@ -2530,5 +2530,5 @@
  
 	if(nativeClass){}
-	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.deleteObjectDescriptor %08lx\n", (long)desc);
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.deleteObjectDescriptor %08lx\n", (dim_long)desc);
 	(*env)->DeleteGlobalRef(env, descriptor->objectClass);
 //printf("free descriptor\n");
@@ -2554,5 +2554,5 @@
 	jclass objectClass = descriptor->objectClass;
 
-	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyIntoObject %08lx\n", (long)desc);
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyIntoObject %08lx\n", (dim_long)desc);
 
 	if(nativeClass){}
Index: /trunk/FACT++/dim/src/dim_thr.c
===================================================================
--- /trunk/FACT++/dim/src/dim_thr.c	(revision 14574)
+++ /trunk/FACT++/dim/src/dim_thr.c	(revision 14575)
@@ -225,5 +225,5 @@
 }
 
-long dim_start_thread(void *(*thread_ast)(void *), long tag)
+dim_long dim_start_thread(void *(*thread_ast)(void *), dim_long tag)
 {
 	pthread_t t_id;
@@ -237,8 +237,8 @@
 	pthread_create(&t_id, &attr, thread_ast, (void *)tag);
 #endif
-	return((long)t_id);
+	return((dim_long)t_id);
 }	
 
-int dim_stop_thread(long t_id)
+int dim_stop_thread(dim_long t_id)
 {
 	int ret;
@@ -533,12 +533,12 @@
 }
 
-long dim_start_thread(void (*thread_ast)(), long tag)
+dim_long dim_start_thread(void (*thread_ast)(), dim_long tag)
 
 {
 	printf("dim_start_thread: not available\n");
-	return (long)0;
-}
-
-int dim_stop_thread(long t_id)
+	return (dim_long)0;
+}
+
+int dim_stop_thread(dim_long t_id)
 {
 	printf("dim_stop_thread: not available\n");
@@ -563,12 +563,12 @@
 typedef struct{
 	void (*thread_ast)();
-	long tag;
+	dim_long tag;
 	
 }THREAD_PARAMS;
 
 #ifndef STDCALL
-long dim_start_thread(void (*thread_ast)(), long tag)
-#else
-long dim_start_thread(unsigned long (*thread_ast)(void *), void *tag)
+dim_long dim_start_thread(void (*thread_ast)(), dim_long tag)
+#else
+dim_long dim_start_thread(dim_long (*thread_ast)(void *), void *tag)
 #endif
 {
@@ -593,9 +593,9 @@
         &threadid);					 /* returns the thread identifier	*/
 #endif
-	return (long)hthread;
-}
-
-
-int dim_stop_thread(long thread_id)
+	return (dim_long)hthread;
+}
+
+
+int dim_stop_thread(dim_long thread_id)
 {
 	int ret;
Index: /trunk/FACT++/dim/src/dis.c
===================================================================
--- /trunk/FACT++/dim/src/dis.c	(revision 14574)
+++ /trunk/FACT++/dim/src/dis.c	(revision 14575)
@@ -37,5 +37,5 @@
 	struct dis_dns_ent *next;
 	struct dis_dns_ent *prev;
-	long dnsid;
+	dim_long dnsid;
 	char task_name[MAX_NAME];
 	TIMR_ENT *dns_timr_ent;
@@ -78,5 +78,5 @@
 	int size;
 	void (*user_routine)();
-	long tag;
+	dim_long tag;
 	int registered;
 	int quality;
@@ -163,7 +163,7 @@
 _DIM_PROTO( void register_dns_services,  (int flag) );
 _DIM_PROTO( void register_services,  (DIS_DNS_CONN *dnsp, int flag, int dns_flag) );
-_DIM_PROTO( void std_cmnd_handler,   (long *tag, int *cmnd_buff, int *size) );
-_DIM_PROTO( void client_info,		(long *tag, int **bufp, int *size) );
-_DIM_PROTO( void service_info,	   (long *tag, int **bufp, int *size) );
+_DIM_PROTO( void std_cmnd_handler,   (dim_long *tag, int *cmnd_buff, int *size) );
+_DIM_PROTO( void client_info,		(dim_long *tag, int **bufp, int *size) );
+_DIM_PROTO( void service_info,	   (dim_long *tag, int **bufp, int *size) );
 _DIM_PROTO( void add_exit_handler,   (int *tag, int *bufp, int *size) );
 _DIM_PROTO( static void exit_handler,	   (int *tag, int *bufp, int *size) );
@@ -176,6 +176,6 @@
 _DIM_PROTO( SERVICE *dis_hash_service_get_next, (int *start, SERVICE *prev, int flag) );
 _DIM_PROTO( static unsigned do_dis_add_service_dns, (char *name, char *type, void *address, int size, 
-								   void (*user_routine)(), long tag, long dnsid ) );
-_DIM_PROTO( static DIS_DNS_CONN *create_dns, (long dnsid) );
+								   void (*user_routine)(), dim_long tag, dim_long dnsid ) );
+_DIM_PROTO( static DIS_DNS_CONN *create_dns, (dim_long dnsid) );
 
 void dis_set_debug_on()
@@ -232,5 +232,5 @@
 
 static unsigned do_dis_add_service_dns( char *name, char *type, void *address, int size, 
-								   void (*user_routine)(), long tag, long dnsid )
+								   void (*user_routine)(), dim_long tag, dim_long dnsid )
 {
 	register SERVICE *new_serv;
@@ -239,5 +239,5 @@
 	int dis_hash_service_insert();
 	DIS_DNS_CONN *dnsp;
-	extern DIS_DNS_CONN *dis_find_dns(long);
+	extern DIS_DNS_CONN *dis_find_dns(dim_long);
 
 	dis_init();
@@ -324,5 +324,5 @@
 
 static unsigned do_dis_add_service( char *name, char *type, void *address, int size, 
-								   void (*user_routine)(), long tag )
+								   void (*user_routine)(), dim_long tag )
 {
 	return do_dis_add_service_dns( name, type, address, size, 
@@ -369,5 +369,5 @@
 
 unsigned dis_add_service( char *name, char *type, void *address, int size, 
-						 void (*user_routine)(), long tag)
+						 void (*user_routine)(), dim_long tag)
 {
 	unsigned ret;
@@ -389,6 +389,6 @@
 }
 
-unsigned dis_add_service_dns( long dnsid, char *name, char *type, void *address, int size, 
-							 void (*user_routine)(), long tag)
+unsigned dis_add_service_dns( dim_long dnsid, char *name, char *type, void *address, int size, 
+							 void (*user_routine)(), dim_long tag)
 {
 	unsigned ret;
@@ -410,5 +410,5 @@
 }
 
-static unsigned do_dis_add_cmnd_dns( char *name, char *type, void (*user_routine)(), long tag, long dnsid )
+static unsigned do_dis_add_cmnd_dns( char *name, char *type, void (*user_routine)(), dim_long tag, dim_long dnsid )
 {
 	register SERVICE *new_serv;
@@ -417,5 +417,5 @@
 	int dis_hash_service_insert();
 	DIS_DNS_CONN *dnsp;
-	extern DIS_DNS_CONN *dis_find_dns(long);
+	extern DIS_DNS_CONN *dis_find_dns(dim_long);
 
 	dis_init();
@@ -488,10 +488,10 @@
 }
 
-static unsigned do_dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag)
+static unsigned do_dis_add_cmnd( char *name, char *type, void (*user_routine)(), dim_long tag)
 {
 	return do_dis_add_cmnd_dns(name, type, user_routine, tag, 0);
 }
 
-unsigned dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag ) 
+unsigned dis_add_cmnd( char *name, char *type, void (*user_routine)(), dim_long tag ) 
 {
 	unsigned ret;
@@ -507,5 +507,5 @@
 }
 
-unsigned dis_add_cmnd_dns( long dnsid, char *name, char *type, void (*user_routine)(), long tag ) 
+unsigned dis_add_cmnd_dns( dim_long dnsid, char *name, char *type, void (*user_routine)(), dim_long tag ) 
 {
 	unsigned ret;
@@ -643,5 +643,5 @@
 	int dns_timr_time;
 	extern int rand_tmout(int, int);
-	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+	extern int open_dns(dim_long, void (*)(), void (*)(), int, int, int);
 	extern DIS_DNS_CONN *find_dns_by_conn_id(int);
 	extern void do_register_services(DIS_DNS_CONN *);
@@ -1044,5 +1044,5 @@
 }
 
-static DIS_DNS_CONN *create_dns(long dnsid)
+static DIS_DNS_CONN *create_dns(dim_long dnsid)
 {
 	DIS_DNS_CONN *dnsp;
@@ -1090,5 +1090,5 @@
 }
 
-int dis_start_serving_dns(long dnsid, char *task/*, int *idlist*/)
+int dis_start_serving_dns(dim_long dnsid, char *task/*, int *idlist*/)
 {
 	char str0[MAX_NAME], str1[MAX_NAME],str2[MAX_NAME],
@@ -1096,5 +1096,5 @@
 	char task_name_aux[MAX_TASK_NAME];
 	extern int open_dns();
-	extern DIS_DNS_CONN *dis_find_dns(long);
+	extern DIS_DNS_CONN *dis_find_dns(dim_long);
 	DIS_DNS_CONN *dnsp;
 	int more_ids[10] = {0};
@@ -1161,7 +1161,7 @@
 				 sizeof(Version_number), 0, 0, dnsid );
 
-		more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (long)dnsp, dnsid );
+		more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (dim_long)dnsp, dnsid );
 		dnsp->dis_client_id = more_ids[1];
-		more_ids[2] = do_dis_add_service_dns( str2, "C", 0, 0, service_info, (long)dnsp, dnsid );
+		more_ids[2] = do_dis_add_service_dns( str2, "C", 0, 0, service_info, (dim_long)dnsp, dnsid );
 		dnsp->dis_service_id = more_ids[2];
 		more_ids[3] = do_dis_add_cmnd_dns( str3, "L:1", add_exit_handler, 0, dnsid );
@@ -1757,6 +1757,6 @@
 dim_print_date_time();
 printf("Updating %s (id = %d, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
-	   servp->name, (int)service_id, (unsigned long)servp, 
-	   Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned long)reqp);
+	   servp->name, (int)service_id, (unsigned dim_long)servp, 
+	   Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned dim_long)reqp);
 }
 */
@@ -2225,5 +2225,5 @@
 int dis_no_dns();
 int hash_index, old_index;
-extern int close_dns(long, int);
+extern int close_dns(dim_long, int);
 CLIENT *clip, *cprevp;
 
@@ -2332,5 +2332,5 @@
 }
 
-void dis_stop_serving_dns(long dnsid)
+void dis_stop_serving_dns(dim_long dnsid)
 {
 	DIS_DNS_CONN *dnsp, *dis_find_dns();
@@ -2726,5 +2726,5 @@
 typedef struct cmnds{
 	struct cmnds *next;
-	long tag;
+	dim_long tag;
 	int size;
 	int buffer[1];
@@ -2733,5 +2733,5 @@
 static DIS_CMND *Cmnds_head = (DIS_CMND *)0;
 
-void std_cmnd_handler(long *tag, int *cmnd_buff, int *size)
+void std_cmnd_handler(dim_long *tag, int *cmnd_buff, int *size)
 {
 	register DIS_CMND *new_cmnd;
@@ -2751,5 +2751,5 @@
 }
 
-int dis_get_next_cmnd(long *tag, int *buffer, int *size)
+int dis_get_next_cmnd(dim_long *tag, int *buffer, int *size)
 {
 	register DIS_CMND *cmndp;
@@ -2829,5 +2829,5 @@
 #endif
 
-void client_info(long *tag, int **bufp, int *size, int *first_time)
+void client_info(dim_long *tag, int **bufp, int *size, int *first_time)
 {
 	register CLIENT *clip;
@@ -2953,5 +2953,5 @@
 }
 
-void service_info(long *tag, int **bufp, int *size, int *first_time)
+void service_info(dim_long *tag, int **bufp, int *size, int *first_time)
 {
 	register SERVICE *servp;
@@ -3334,5 +3334,5 @@
 }
 
-DIS_DNS_CONN *dis_find_dns(long dnsid)
+DIS_DNS_CONN *dis_find_dns(dim_long dnsid)
 {
 	DIS_DNS_CONN *dnsp;
@@ -3369,6 +3369,6 @@
 {
 	DIS_DNS_CONN *dnsp;
-	extern long dns_get_dnsid();
-	long dnsid;
+	extern dim_long dns_get_dnsid();
+	dim_long dnsid;
 
 	dnsid = dns_get_dnsid(conn_id, SRC_DIS);
Index: /trunk/FACT++/dim/src/discpp.cxx
===================================================================
--- /trunk/FACT++/dim/src/discpp.cxx	(revision 14574)
+++ /trunk/FACT++/dim/src/discpp.cxx	(revision 14575)
@@ -61,5 +61,5 @@
 		itsId = dis_add_service( name, format, NULL, 0, 
 //				user_routine, itsTagId);
-				user_routine, (long)this);
+				user_routine, (dim_long)this);
 		DimServer::start();
 	}
@@ -68,5 +68,5 @@
 		itsId = dis_add_service_dns( itsDns->getDnsId(), name, format, NULL, 0, 
 //				user_routine, itsTagId);
-				user_routine, (long)this);
+				user_routine, (dim_long)this);
 //		itsDns->addServiceId(itsId);
 		DimServer::start(itsDns);
@@ -139,5 +139,5 @@
 		itsId = dis_add_cmnd( name, format, command_routine,
 //				itsTagId);
-				(long)this);
+				(dim_long)this);
 		DimServer::start();
 	}
@@ -146,5 +146,5 @@
 		itsId = dis_add_cmnd_dns( itsDns->getDnsId(), name, format, command_routine,
 //			itsTagId);
-			(long)this);
+			(dim_long)this);
 //		itsDns->addServiceId(itsId);
 		DimServer::start(itsDns);
@@ -248,8 +248,8 @@
 		itsIdIn = dis_add_cmnd( itsNameIn, formatin, 
 //			rpcin_routine, itsTagId);
-			rpcin_routine, (long)this);
+			rpcin_routine, (dim_long)this);
 		itsIdOut = dis_add_service( itsNameOut, formatout, 0,0, 
 //			rpcout_routine, itsTagId);
-			rpcout_routine, (long)this);
+			rpcout_routine, (dim_long)this);
 		DimServer::start();
 	}
@@ -258,8 +258,8 @@
 		itsIdIn = dis_add_cmnd_dns( itsDns->getDnsId(), itsNameIn, formatin, 
 //			rpcin_routine, itsTagId);
-			rpcin_routine, (long)this);
+			rpcin_routine, (dim_long)this);
 		itsIdOut = dis_add_service_dns( itsDns->getDnsId(), itsNameOut, formatout, 0,0, 
 //			rpcout_routine, itsTagId);
-			rpcout_routine, (long)this);
+			rpcout_routine, (dim_long)this);
 //		itsDns->addServiceId(itsIdIn);
 //		itsDns->addServiceId(itsIdOut);
@@ -369,5 +369,5 @@
 }
 
-long DimServerDns::getDnsId()
+dim_long DimServerDns::getDnsId()
 {
 	return itsDnsId;
@@ -445,5 +445,5 @@
 void DimServer::start(DimServerDns *dns, const char *name)
 {
-	long dnsid;
+	dim_long dnsid;
 
 	DISABLE_AST
@@ -487,5 +487,5 @@
 void DimServer::start(DimServerDns *dns)
 {
-	long dnsid;
+	dim_long dnsid;
 	char *name;
 	int isAuto;
@@ -669,5 +669,5 @@
 }
 
-long DimServer::addDns(const char *node, int port) 
+dim_long DimServer::addDns(const char *node, int port) 
 {
 	return dis_add_dns((char *)node, port); 
Index: /trunk/FACT++/dim/src/dtq.c
===================================================================
--- /trunk/FACT++/dim/src/dtq.c	(revision 14574)
+++ /trunk/FACT++/dim/src/dtq.c	(revision 14575)
@@ -389,5 +389,5 @@
 }
 	
-TIMR_ENT *dtq_add_entry(int queue_id, int time, void (*user_routine)(), long tag)
+TIMR_ENT *dtq_add_entry(int queue_id, int time, void (*user_routine)(), dim_long tag)
 {
 	TIMR_ENT *new_entry, *queue_head, *auxp, *prevp;
@@ -780,5 +780,5 @@
 }
 
-void dtq_start_timer(int time, void (*user_routine)(), long tag)
+void dtq_start_timer(int time, void (*user_routine)(), dim_long tag)
 {
 	extern void dim_init_threads();
@@ -796,5 +796,5 @@
 
 
-int dtq_stop_timer(long tag)
+int dtq_stop_timer(dim_long tag)
 {
 	TIMR_ENT *entry, *queue_head;
@@ -816,5 +816,5 @@
 static int Dtq_sleeping = 0;
 
-void dtq_sleep_rout(long tag)
+void dtq_sleep_rout(dim_long tag)
 {
 	if(tag){}
Index: /trunk/FACT++/dim/src/examples/rpc_client.cxx
===================================================================
--- /trunk/FACT++/dim/src/examples/rpc_client.cxx	(revision 14574)
+++ /trunk/FACT++/dim/src/examples/rpc_client.cxx	(revision 14575)
@@ -41,5 +41,5 @@
 	int out, in;
 	
-	sprintf(name,"TESTRPC%d/INT",(long)tag);
+	sprintf(name,"TESTRPC%d/INT",(dim_long)tag);
 	myRpc = new DimRpcInfo(name, 10, -1);
 //	myRpc = new Rpc(name);
@@ -54,5 +54,5 @@
 dim_lock();
 dim_print_date_time();
-cout << "Instance "<<(long)tag<<" sent "<<out<< " got "<<in <<endl;
+cout << "Instance "<<(dim_long)tag<<" sent "<<out<< " got "<<in <<endl;
 dim_unlock();
 		out++;
Index: /trunk/FACT++/dim/src/examples/test_client.c
===================================================================
--- /trunk/FACT++/dim/src/examples/test_client.c	(revision 14574)
+++ /trunk/FACT++/dim/src/examples/test_client.c	(revision 14575)
@@ -57,5 +57,5 @@
 {
 	if(tag){}
-	printf("Received VERSION %lx, %d\n", (long)buf, *size);
+	printf("Received VERSION %lx, %d\n", (dim_long)buf, *size);
 }
 
Index: /trunk/FACT++/dim/src/examples/test_server.c
===================================================================
--- /trunk/FACT++/dim/src/examples/test_server.c	(revision 14574)
+++ /trunk/FACT++/dim/src/examples/test_server.c	(revision 14575)
@@ -70,5 +70,5 @@
 	int on = 0;
 */
-	long dnsid = 0;
+	dim_long dnsid = 0;
 	char extra_dns[128];
 	int new_dns = 0;
Index: /trunk/FACT++/dim/src/open_dns.c
===================================================================
--- /trunk/FACT++/dim/src/open_dns.c	(revision 14574)
+++ /trunk/FACT++/dim/src/open_dns.c	(revision 14575)
@@ -173,5 +173,5 @@
 	char node[MAX_DNS_NODE];
 	int port;
-	long sid, cid;
+	dim_long sid, cid;
 
 	DISABLE_AST
@@ -235,5 +235,5 @@
 }
 
-long dis_add_dns(char *node_name, int port_number)
+dim_long dis_add_dns(char *node_name, int port_number)
 {
 	DNS_CONN *connp;
@@ -253,8 +253,8 @@
 		dll_insert_queue( (DLL *) DNS_conn_head, (DLL *) connp );
 	}
-	return (long)connp;
-}
-
-long dic_add_dns(char *node_name, int port_number)
+	return (dim_long)connp;
+}
+
+dim_long dic_add_dns(char *node_name, int port_number)
 {
 	DNS_CONN *connp;
@@ -274,5 +274,5 @@
 		dll_insert_queue( (DLL *) DNS_conn_head, (DLL *) connp );
 	}
-	return (long)connp;
+	return (dim_long)connp;
 }
 
@@ -296,5 +296,5 @@
 }
 
-int close_dns(long dnsid, SRC_TYPES src_type)
+int close_dns(dim_long dnsid, SRC_TYPES src_type)
 {
 	DNS_CONN *connp;
@@ -311,5 +311,5 @@
 }
 
-int open_dns(long dnsid, void (*recv_rout)(), void (*error_rout)(), int tmout_min, int tmout_max, SRC_TYPES src_type )
+int open_dns(dim_long dnsid, void (*recv_rout)(), void (*error_rout)(), int tmout_min, int tmout_max, SRC_TYPES src_type )
 {
 	char nodes[MAX_DNS_NODE];
@@ -424,5 +424,5 @@
 }	
 
-long dns_get_dnsid(int conn_id, SRC_TYPES src_type)
+dim_long dns_get_dnsid(int conn_id, SRC_TYPES src_type)
 {
 	DNS_CONN *connp;
@@ -449,11 +449,11 @@
 		if(connp == DNS_ids[src_type])
 		{
-			return (long)0;
+			return (dim_long)0;
 		}
 		else
 		{
-			return (long)connp;
-		}
-	}
-	return (long)-1;
-}
+			return (dim_long)connp;
+		}
+	}
+	return (dim_long)-1;
+}
