Giter VIP home page Giter VIP logo

renci.sshnet.async's People

Contributors

ascott18 avatar johnthegr8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

renci.sshnet.async's Issues

Support for cancellationToken

The async methods do not expose CancellationToken parameter.
Since the underlying methods do have access to AsyncCallback, perhaps it would be possible to cancel the upload/download operation in progress?

Delete Async Method?

Hey

Firstly, thank for creating the library, really easy to use.

Wondering if I'm missing something, is there a way to do DeleteAsync?

Thanks

Cannot be referenced from a strongly named assembly

Applications targeting .NET Framework 471 and are strongly named fails to load Renci.SshNet.Async.

Could not load file or assembly 'Renci.SshNet.Async, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required.

Exceptions from Multi Connection

Hello. First of all, thanks for share this code.

I'm trying to connect multi sftp client and transfer files, but after connecting 7th client, following exceptions are occurred continuously.

Here is code what I'm using

        async Task myTask()
        {
            using (var ftp = new SftpClient(hostName, userName, passWord))
            {
                ftp.Connect();
                List<Task> uploader = new List<Task>();
                ftp.KeepAliveInterval = TimeSpan.FromMinutes(1);
                if (ftp.Exists("tmp") == false)
                    ftp.CreateDirectory("tmp");
                foreach (var info in infos)
                {
                    if ((info.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
                        continue;
                    uploader.Add(Task.Run(async () =>
                    {
                        using (Stream fileStream = new FileStream(info.FullName, FileMode.Open))
                            await ftp.UploadAsync(fileStream, "tmp/" + info.Name);
                    }));
                }
		await Task.WhenAll(uploader);
            }
        }

And here is exceptions I've met

Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
  at Renci.SshNet.Common.AsyncResult.EndInvoke () [0x00035] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.SftpClient.EndUploadFile (System.IAsyncResult asyncResult) [0x0001d] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <567df3e0919241ba98db88bec4c6696f>:0 
Renci.SshNet.Common.SshConnectionException: The connection was closed by the server: data packet referred to nonexistent channel 0 (ProtocolError).
  at Renci.SshNet.Session.WaitOnHandle (System.Threading.WaitHandle waitHandle, System.TimeSpan timeout) [0x00041] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Session.Renci.SshNet.ISession.WaitOnHandle (System.Threading.WaitHandle waitHandle) [0x0000d] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Channels.Channel.WaitOnHandle (System.Threading.WaitHandle waitHandle) [0x00000] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Channels.Channel.GetDataLengthThatCanBeSentInMessage (System.Int32 messageLength) [0x00051] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Channels.Channel.SendData (System.Byte[] data, System.Int32 offset, System.Int32 size) [0x0000d] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Channels.Channel.SendData (System.Byte[] data) [0x00000] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.SubsystemSession.SendData (System.Byte[] data) [0x0000c] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Sftp.SftpSession.SendMessage (Renci.SshNet.Sftp.SftpMessage sftpMessage) [0x00007] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Sftp.SftpSession.SendRequest (Renci.SshNet.Sftp.Requests.SftpRequest request) [0x00028] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.Sftp.SftpSession.RequestWrite (System.Byte[] handle, System.UInt64 serverOffset, System.Byte[] data, System.Int32 offset, System.Int32 length, System.Threading.AutoResetEvent wait, System.Action`1[T] writeCompleted) [0x00042] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.SftpClient.InternalUploadFile (System.IO.Stream input, System.String path, Renci.SshNet.Sftp.Flags flags, Renci.SshNet.Sftp.SftpUploadAsyncResult asyncResult, System.Action`1[T] uploadCallback) [0x000cc] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.SftpClient+<>c__DisplayClass46_0.<BeginUploadFile>b__0 () [0x00000] in <3958172c0ff546da829fbc81177cf6a9>:0 
Renci.SshNet.Common.SshConnectionException: Client not connected.
  at Renci.SshNet.Common.AsyncResult.EndInvoke () [0x00035] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at Renci.SshNet.SftpClient.EndUploadFile (System.IAsyncResult asyncResult) [0x0001d] in <3958172c0ff546da829fbc81177cf6a9>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <567df3e0919241ba98db88bec4c6696f>:0 

Many thanks for reading

Add ConnectAsync method

If possible, I think a ConnectAsync() method would be very useful. Currently, when a client is trying and failing to connect to a server, the Connect() method lasts several seconds and thus freezes the app that it is in. Adding an asynchronous connection method would allow apps to establish SSH or SFTP connections without holding up the UI thread.

Change Dependency to SSH.NET 2020.0.0 if possible

On the release page for SSH.NET 2020.0.0 it states:

SSH.NET now supports the following additional key exchange algorithms:

  • curve25519-sha256
  • [email protected]
  • ecdh-sha2-nistp256
  • ecdh-sha2-nistp384
  • ecdh-sha2-nistp521
  • diffie-hellman-group14-sha256
  • diffie-hellman-group16-sha512

There are already a lot of SSH servers that don't accept the old algorithms anymore.
If you can verify that Renci.SshNet.Async works with the newer version of SSH.NET, this would hopefully prevent other software from accidently importing the older version.

Thanks,
Mathias

SSH.NET Dependency Issue

The dependency of SSH.net being used is 2016.1.0. There is a known issue around disposing when trying to disconnect. Should this code base downgrade the SSH.NET dependency to 2016.0.0? Here is the issue - sshnet/SSH.NET#355

Event of file upload

  1. If the file size is 0kb, the upload event is not triggered after the file is successfully uploaded.
  2. The input parameter to the event can get the filename rather than the fullpath name, so files with the same name cannot be distinguished.

Getting random exceptions on iOS

Hi,

I am getting following exceptions:

System.MissingMethodException: Default constructor not found for type Renci.SshNet.Security.KeyExchangeDiffieHellmanGroupExchangeSha256
at Renci.SshNet.Session.WaitOnHandle (System.Threading.WaitHandle waitHandle, System.TimeSpan timeout) [0x00041] in :0
at Renci.SshNet.Session.WaitOnHandle (System.Threading.WaitHandle waitHandle) [0x0000d] in :0
at Renci.SshNet.Session.Connect () [0x00246] in :0
at Renci.SshNet.BaseClient.Connect () [0x00077] in :0
at PackingPhotosTransfer.MainPage.SaveImages (System.Object sender, System.EventArgs e) [0x00153] i

{System.InvalidOperationException: Invalid response.
at Renci.SshNet.Common.AsyncResult.EndInvoke () [0x00035] in :0
at Renci.SshNet.SftpClient.EndUploadFile (System.IAsyncResult asyncResult) [0x0001d] in :0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs:538
--- End of stack trace from previous location where exception was thrown ---

Deadlock when disposing SftpClient since v1.3.0+

When running the following code, a deadlock occurs when trying to disconnect from the server:

    class Program
    {
        static void Main(string[] args)
        {
            using var sftpClient = new SftpClient("localhost", 22, "user", "password");
            sftpClient.Connect();
            sftpClient.WriteAllText("test.txt", "blah", Encoding.UTF8);
        }
    }

The server this was ran against was a docker container using the following command:

docker run --rm -it -p 22:22 atmoz/sftp user:password:::

MacOS
.NET Core 3.1

The above snippet of code works fine with v1.2.0 of Renci.SshNet.Async.

Renci.SshNet (C#) connect error : An established connection was aborted by the server

  1. I got this error when i try to use SftpClient or ScpClient to connect my Arch linux server. The SSH service is running properly on the server, and i can use other ssh tools to connect it.
  2. I can use the same code to connect other servers, and it work properly.
  3. I changed a computer to connect to my Arch linux server with the same code and still got this error.

Azure Function Issue

Trying to leverage from an Azure function with the following code

image

Receiving the following error when trying to connect

image

Here is how my project is setup

image

Pulled in a coworker to take a look and he noticed that an old assembly was being included, Renci.SshNet.Async was pulling in SSH.NET 2016.1.0. We installed SSH.NET 2024.0.0 and our connection issues cleared up. Without 2024.0.0 installed, the client will not connect.

image

Hopefully this helps someone else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.