sshnet / sshnet/SSH.NET

Renci.SshNet.Sftp iOS iPad - Connection Error

オープン
#804 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
4.4k
フォーク
993
平均マージ
9日 21時間
マージ済み PR(30日)
1

説明

I've a problem while connecting with a sftp - Server with my iPad iOS 14.4.1.

I'm using the Renci.SshNet.Sftp Framework. On Mac Osx or Windows everything works perfectly. But on iPad its stops working at "sshClient.Connect();" I put the private key file into the StreamingAssets Folder.

I'm using port 22. The server does not get any connection try.

`public void DownloadDirectory(){
Renci.SshNet.ConnectionInfo conn =
new ConnectionInfo(hostName, port, username, new AuthenticationMethod[]
{

    new PrivateKeyAuthenticationMethod(username, new PrivateKeyFile[]
           { new PrivateKeyFile(Application.streamingAssetsPath + "/privatekeyFile", "") }),
    });
    try
    {
        using (var sshClient = new SftpClient(conn))
        {
            sshClient.Connect();
            var files = sshClient.ListDirectory(directory);
            foreach (var file in files)
            {
                if (!file.Name.StartsWith(".") && file.Name.StartsWith(localFileName))
                {
                    string remoteFileName = file.Name;
                    using (Stream file1 = File.OpenWrite(Application.streamingAssetsPath + localFileName))
                    {
                        Debug.Log(directory + remoteFileName);
                        sshClient.DownloadFile(directory + remoteFileName, file1);
                    }
                }
            }
        }
    }
    catch (Renci.SshNet.Common.SshConnectionException)
    {
        Debug.LogError("Cannot connect to the server.");
    }
    catch (System.Net.Sockets.SocketException)
    {
        Debug.LogError("Unable to establish the socket.");
    }
    catch (Renci.SshNet.Common.SshAuthenticationException)
    {
        Debug.LogError("Authentication of SSH session failed.");
    }
}`

Error Message from Xcode.

` (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

NullReferenceException: Object reference not set to an instance of an object.
  at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate () [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T].CreateCustomNoMatchDelegate (System.Reflection.MethodInfo invoke) [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.CallSite`1[T].Create (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0
  at Renci.SshNet.Session.HandleMessageCore (Renci.SshNet.Messages.Message message) [0x00000] in <00000000000000000000000000000000>:0
  at Renci.SshNet.Session.MessageListener () [0x00000] in <00000000000000000000000000000000>:0
  at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
  at Renci.SshNet.Abstractions.ThreadAbstraction+<>c__DisplayClass1_0.<ExecuteThread>b__0 (System.Object o) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.WaitCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0

(Filename: currently not available on il2cpp Line: -1)`

Is Renci.sshnet supporting iOS devices ?
Hope you can help me.

Regards

MotionBrain

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、例を使って iOS 14.4.1 Unity/IL2CPP の接続失敗を再現し、スタックトレースがライブラリに入る箇所である Renci.SshNet.Session.HandleMessageCore を調査します。iOS の動作を macOS または Windows と比較し、報告された例外なしに SSH.NET が対象デバイスへ接続してファイルを転送できるかを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, ios, unity
領域
mobile-dev, networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。