private DPE_PublicationsSQLReader(string publicationsDataBaseConnectionString, string publicationName)
            {
                //gets a connection to the
                this._dataBaseSonnectionString = publicationsDataBaseConnectionString;


                this._locker         = new object();
                this._DATA_RESET_PCQ = new ThreadPooledProducerConsumerQueue();
                this._DATA_RESET_PCQ.NewItemDetected += this.EventHandling_DATA_RESET_PCQ_NewItemDetected;
                this._DATA_UPDATE_PCQ = new ThreadPooledProducerConsumerQueue();
                this._DATA_UPDATE_PCQ.NewItemDetected += this.EventHandling_DATA_UPDATE_PCQ_NewItemDetected;

                //creates the reading timer
                this._readTimer           = new System.Timers.Timer(1500);
                this._readTimer.Elapsed  += this.EventHandling_readTimer_Elapsed;
                this._readTimer.AutoReset = false;
                this._readTimer.Stop();

                this._isFirstTimeRead = true;
                this._tablename       = publicationName;
                this._keepReading     = false;
                this._publicationName = publicationName;

                this._UPDATE_StatisticsHandler = new EventStatisticsHandler();
                this._RESET_StatisticsHandler  = new EventStatisticsHandler();

                this._dataReadCommandTest = "";
                this._lastRowIDReaded     = -1;             //initialization
            }
Exemple #2
0
            public DPE_PublicationsSQLWriter(string publicationsDataBaseConnectionString, string publicationName)
            {
                this._dataBaseConnectionString = publicationsDataBaseConnectionString;

                //clears the table every 30 seconds
                this._dataClearTimer           = new System.Timers.Timer(60000);
                this._dataClearTimer.Elapsed  += this.EventHandling__dataClearTimer_Elapsed;
                this._dataClearTimer.AutoReset = false;
                this._dataClearTimer.Start();

                this._publicationName = publicationName;

                this._UPDATE_StatisticsHandler = new EventStatisticsHandler();
                this._RESET_StatisticsHandler  = new EventStatisticsHandler();

                this._DATA_RESET_PCQ = new ThreadPooledProducerConsumerQueue();
                this._DATA_RESET_PCQ.NewItemDetected += this.EventHandling_DATA_RESET_PCQ_NewItemDetected;
                this._DATA_UPDATE_PCQ = new ThreadPooledProducerConsumerQueue();
                this._DATA_UPDATE_PCQ.NewItemDetected += this.EventHandling_DATA_UPDATE_PCQ_NewItemDetected;
            }
Exemple #3
0
            private void StartServer()
            {
                this._serverID = Guid.NewGuid().ToString();
                this._serverID = this._serverID.ToUpper();
                this._serverID = this._serverID.Replace("-", "");

                this._hostName = Dns.GetHostName();

                //*****************************************************************************************
                //client incomming connections management

                string    host            = System.Net.Dns.GetHostName();
                IPAddress local_IPAddress = CommunicationsLibrary.Utilities.CommunicationsUtilities.GetActiveIPAddress();
                int       portNumber      = Convert.ToInt32(this.ListeningPort);

                this._tcpLsn = new TcpListener(local_IPAddress, portNumber);

                //starts the listener
                this._tcpLsn.Start();
                this._tcpLsn.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, SocketsServerDefinitions.MAX_SOCKET_DATA_BUFFER_SIZE);
                this._tcpLsn.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, SocketsServerDefinitions.MAX_SOCKET_DATA_BUFFER_SIZE);
                this._tcpLsn.Server.LingerState = new LingerOption(false, 0);
                this._tcpLsn.Server.NoDelay     = false;
                this._tcpLsn.Server.Blocking    = true;

                this._StartDateTime = DateTime.Now;


                this._dataBroadCast = true;

                this._incommingDataProcessingQueue = new ThreadPooledProducerConsumerQueue();
                this._incommingDataProcessingQueue.NewItemDetected += this.EventHandling_incommingDataProcessingQueue_NewItemDetected;


                //starts the ASYNCHORNIC connections listening
                this._tcpLsn.Server.BeginAccept(new AsyncCallback(ClientConnectionCallback), this._tcpLsn.Server);
            }