public static Command ReceiveMessage(State state, UdpClient udpServer, NodeDetails node, BlockchainCommands commandType, int sourcePort)
 {
     while (true)
     {
         var command = ReceiveCommand(udpServer, node, sourcePort);
         state.OutputLog.Add($"{DateTime.Now} - Received {command.CommandType} command.");
         if (command.CommandType.Equals(commandType) || command.CommandType.Equals(BlockchainCommands.NO_RESPONSE))
         {
             return(command);
         }
         else
         {
             RequestsProcessor.ProcessReceiveRequest(state, command, node);
         }
     }
 }
 private void ReceiveRequests()
 {
     if (state.NodeState.Equals(NodeState.AVAILABLE))
     {
         state.NodeState = NodeState.RECEIVING;
         for (int i = 0; i < seedNodes.Count; i++)
         {
             var    remoteEp     = new IPEndPoint(IPAddress.Any, seedNodes[i].Port);
             byte[] messageBytes = ReceiveBytePacket(udpServer, remoteEp);
             if (messageBytes.Length != 0)
             {
                 RequestsProcessor.ProcessReceiveRequest(state, messageBytes, seedNodes[i]);
             }
         }
         state.NodeState = NodeState.AVAILABLE;
         Thread.Sleep(6000);
     }
 }