/// <summary>
        /// Send start message for certain node
        /// </summary>
        /// <param name="recieverNodeIp"></param>
        /// <param name="mutualExclusionAlgorithm"></param>
        /// <param name="resourceId"></param>
        private void sendStartMessage(string recieverNodeIp,
                 MutualExclusionAlgorithm mutualExclusionAlgorithm,
               String resourceId)
        {

            Thread thread = new Thread(
               new ThreadStart(
                   () =>
                   {

                       try
                       {
                           INodeOperation nodeAPI = createNodeAPI(recieverNodeIp);
                           nodeAPI.start(mutualExclusionAlgorithm.ToString(), resourceId, getExtentLogicalClock());
                       }
                       catch (Exception ex)
                       {
                           Console.WriteLine("Exception :" + ex.Message);
                       }
                   })
               );

            thread.Start();

        }
        /// <summary>
        /// Send an access request to use certain resource
        /// </summary>
        /// <param name="algorithm"></param>
        /// <param name="resourceId"></param>
        public void accessRequest(MutualExclusionAlgorithm algorithm,
                String resourceId)
        {

            switch (algorithm)
            {
                case MutualExclusionAlgorithm.Ricart:
                    richardAcessRequest(resourceId);
                    break;

                case MutualExclusionAlgorithm.Central:

                    centralAcessRequest(resourceId);
                    break;

                default:
                    break;
            }

        }
        //The mutual exclusion part 

        /// <summary>
        /// Start a distributed read / write process by sending a start message to all the other nodes in the network.
        /// </summary>
        /// <param name="mutualExclusionAlgorithm"></param>
        /// <param name="resourceId"></param>


        public void startDistributedReadWrite(MutualExclusionAlgorithm mutualExclusionAlgorithm, String resourceId)
        {

            // send start read/write for the all other nodes
            foreach (String nodeIp in networkNodesIPs.Keys)
            {
                sendStartMessage(nodeIp, mutualExclusionAlgorithm, resourceId);
            }

            // also start on the current node
            start(mutualExclusionAlgorithm.ToString(), resourceId, getExtentLogicalClock());
        }