private void TaskToRestablishThePreviousConnectionsToPublicationsAfterDSSServerConnectionLoss_ThreadFcn()
            {
                try
                {
                    IEnumerator enumm    = default(IEnumerator);
                    Hashtable   newTable = new Hashtable();

                    lock (this._tableOfConnectionInfoRegistersOfConnectionsToPublications)
                    {
                        enumm = _tableOfConnectionInfoRegistersOfConnectionsToPublications.GetEnumerator();
                        PublicationConnectionInfo cnnInfo = new PublicationConnectionInfo();
                        while (enumm.MoveNext())
                        {
                            cnnInfo = (PublicationConnectionInfo)(((DictionaryEntry)enumm.Current).Value);
                            this.ReconnectToDataPublication(cnnInfo.PublicationName);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            private void ReconnectToDataPublication(string publicationName)
            {
                //***********************************************************************
                //creates a task to restablisht the connection to the publication
                if (this._tableOfConnectionInfoRegistersOfConnectionsToPublications.ContainsKey(publicationName))
                {
                    PublicationConnectionInfo cnnInfo = new PublicationConnectionInfo();
                    cnnInfo = (PublicationConnectionInfo)this._tableOfConnectionInfoRegistersOfConnectionsToPublications[publicationName];
                    this.ScheduleConnectionTaskToAPublication(cnnInfo.PublicationName, cnnInfo.ConnectionMode);
                }

                //***********************************************************************
                //frees the connection handler resources of previous connection to the publication
                DPE_PublicationConnectionHandler publicationCnnHandler = default(DPE_PublicationConnectionHandler);

                publicationCnnHandler = this._STXDSSPublicationConnectionHandlersContainer.GetConnectionHandler(publicationName);

                if (!(publicationCnnHandler == null))
                {
                    try
                    {
                        publicationCnnHandler.PublicationDataReceived      -= STXDSSPublicationConnectionHandler_PublicationDataReceived;
                        publicationCnnHandler.ConnectionToPublicationLost  -= STXDSSPublicationConnectionHandler_ConnectionLost;
                        publicationCnnHandler.PublicationDataResetReceived -= STXDSSPublicationConnectionHandler_PublicationDataResetReceived;
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        publicationCnnHandler.Dispose();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            internal DPE_PublicationConnectionHandler CreatePublicationConnectionHandler(DPE_PublicationConnectionHandler_Type handlerType, DPE_DataPublicationsClient client, string PublicationName, string PublicationHostName, int publicationsSocketsServerPortNumber, DPE_ServerDefs.DPE_PublicationConnectionMode connectionMode)
            {
                //***********************************************************************************************
                //creates the handler according to the type of connection
                DPE_PublicationConnectionHandler publicationCnnHandler = null;

                publicationCnnHandler = new DPE_PublicationConnectionHandler(handlerType, client, PublicationName, PublicationHostName, publicationsSocketsServerPortNumber, connectionMode);

                if (!(publicationCnnHandler == null))
                {
                    try
                    {
                        //evaluates if the client is not the publisher of the publication, in order to avoid thepublisher client to
                        //receive its own publication update
                        if (!this._STXDataSocketClient.PublicationsPostManager.ContainsPublicationDefinition(PublicationName))
                        {
                            if (publicationCnnHandler.HandlerType == DPE_PublicationConnectionHandler_Type.subscriptorHandler)
                            {
                                publicationCnnHandler.PublicationDataReceived      += STXDSSPublicationConnectionHandler_PublicationDataReceived;
                                publicationCnnHandler.PublicationDataResetReceived += STXDSSPublicationConnectionHandler_PublicationDataResetReceived;
                            }
                        }
                        //for both type of handlers is created a handler to the connectio lost event in order to know when a connection to a publication
                        //is lost
                        publicationCnnHandler.ConnectionToPublicationLost += STXDSSPublicationConnectionHandler_ConnectionLost;
                    }
                    catch (Exception)
                    {
                        publicationCnnHandler.PublicationDataReceived      -= STXDSSPublicationConnectionHandler_PublicationDataReceived;
                        publicationCnnHandler.ConnectionToPublicationLost  -= STXDSSPublicationConnectionHandler_ConnectionLost;
                        publicationCnnHandler.PublicationDataResetReceived -= STXDSSPublicationConnectionHandler_PublicationDataResetReceived;
                    }

                    try
                    {
                        this._STXDSSPublicationConnectionHandlersContainer.AddPublicationConnectionHandler(publicationCnnHandler);
                    }
                    catch (Exception ex)
                    {
                        CustomEventLog.WriteEntry(EventLogEntryType.Error, ex.ToString());
                    }

                    if (handlerType == DPE_PublicationConnectionHandler_Type.subscriptorHandler)
                    {
                        //---------------------------------------
                        //saves into a has table the publication name and its connection mode for further reference when is needed to perfofm
                        //automatic reconnections just for connections handlers defined as subscriptors handler
                        PublicationConnectionInfo cnnInfo = new PublicationConnectionInfo();
                        cnnInfo.connectionType  = handlerType;
                        cnnInfo.PublicationName = PublicationName;
                        cnnInfo.ConnectionMode  = connectionMode;

                        try
                        {
                            //saves the connection information for the subscriptors connection type handlers
                            if (this._tableOfConnectionInfoRegistersOfConnectionsToPublications.ContainsKey(PublicationName))
                            {
                                this._tableOfConnectionInfoRegistersOfConnectionsToPublications.Remove(PublicationName);
                            }
                            this._tableOfConnectionInfoRegistersOfConnectionsToPublications.Add(PublicationName, cnnInfo);
                        }
                        catch (Exception ex)
                        {
                            CustomEventLog.WriteEntry(EventLogEntryType.Error, ex.ToString());
                        }
                    }
                }

                //---------------------------------------
                return(publicationCnnHandler);
            }