Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Oakenn · Aug 07, 2020 at 12:39 PM · errorchess

Android Stockfish chess engine error on call

Hi,
I am trying to call the stockfish chess engine (stockfish-10-armv7) from android but getting an error (mono-io-layer-error (5)) when doing the new process at runtime. The PC build worked fine.The engine needs to be run as a detached process and the communication is done via the input output stream. Does anyone know what this mono-io-layer-error (5) is about?
alt text

 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using UnityEngine;
 using UnityEngine.Networking;
 using UnityEngine.Android;
 
 
 public static class StockFish
 {
 
     public static Process mProcess;
     public static string engineText = "";
 
     public static void StartEngine()
     {
 
         engineLog("datapath: " + Application.dataPath);        
         engineLog("Streamingpath: " + Application.streamingAssetsPath);
         engineLog("Persist path : " + Application.persistentDataPath);
         //
         string sfBin = "stockfish-10-armv7";
         string sfPathFile = Path.Combine(Application.persistentDataPath, sfBin);
 
         string sfPathAsset = Path.Combine(Application.streamingAssetsPath, sfBin);
 
         loadWeb(sfPathAsset, sfPathFile);
         if (!File.Exists(sfPathFile))
         {
             engineLog("-------FILE NOT FOUND--------------------");
             return;
         }
         else
         {
             engineLog("FILE EXISTS -------------------------------");
         }
         try
         {
             mProcess = new Process();
             ProcessStartInfo si = new ProcessStartInfo()
             {
                 FileName = sfPathFile,
                 UseShellExecute = false,
                 CreateNoWindow = true,
                 RedirectStandardError = true,
                 RedirectStandardInput = true,
                 RedirectStandardOutput = true
             };
             mProcess.StartInfo = si;
             mProcess.OutputDataReceived += new DataReceivedEventHandler(MProcess_OutputDataReceived);
             mProcess.Start();
             mProcess.BeginErrorReadLine();
             mProcess.BeginOutputReadLine();
 
         }
         catch (Exception e)
         {
             engineLog("ERROR Process:" + e.Message);
             return;
         }
         engineLog("------RUN OK----------------");
         UciCmd("uci");
         UciCmd("isready");
         //SendLine("position fen " + forsythEdwardsNotationString);
         //SendLine("go movetime 5000");
 
 
     }
     public static void loadWeb(string inFile, string outFile)
     {
         var loadingRequest = UnityWebRequest.Get(inFile);
 
         loadingRequest.SendWebRequest();
         while (!loadingRequest.isDone)
         {
             if (loadingRequest.isNetworkError || loadingRequest.isHttpError)
             {
                 engineLog("While network error");
                 break;
             }
         }
         if (loadingRequest.isNetworkError || loadingRequest.isHttpError)
         {
             engineLog("network error");
         }
         else
         {
             try
             {
                 File.WriteAllBytes(outFile, loadingRequest.downloadHandler.data);
             }
             catch (Exception e)
             {
                 engineLog("ERROR File Write:" + e.Message);
                 return;
             }
 
         }
     }
     public static void engineLog(string engString)
     {
         engineText = engineText + engString + "\n";
     }
     public static void UciCmd(string command)
     {
         mProcess.StandardInput.WriteLine(command);
         mProcess.StandardInput.Flush();
     }
 
     private static void MProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
     {
         engineLog(e.Data.ToString());
     }
 
 
 }
 


moniioerror.png (221.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by XLRLimits · Mar 01 at 10:05 PM

Hello i have the same as thing, did you managed to fix this? I think the fix is regarding ill2cpp and net also i think we might not have permissiom to access the stockfish so file.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

174 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android build error "you need android files to build" 1 Answer

GL.End requires material.SetPass before! Still with 5.6.0f3. Happens with a default scene. 2 Answers

How to identify a freeze bug? 2 Answers

Small error C# 2 Answers

Compiler Error: unexpected char 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges