Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Small File Upload Problem

$
0
0

The newest version of the code is hanging during the upload portion.

  using (Renci.SshNet.SftpClient sftp = new Renci.SshNet.SftpClient(host, uid, pwd))
        {
            using (Stream fin = File.OpenRead(fullFileName))
            {
                try
                {
                    sftp.ConnectionInfo.Timeout = new TimeSpan(0, 0, 30);


                    Logs.Info("Connecting:{0},{1},{2}", host,uid,pwd);
                    sftp.Connect();

                    Logs.Info("Connected, uploading file: {0}",fi.Name);
                    sftp.UploadFile(fin, hostPath + fi.Name);
                    Logs.Info("Uploaded {0} which was {1} bytes.", fi.Name, fi.Length);
                    Logs.Info("Transferred");
                    uploadSuccess = true;
                }
                catch (Exception e)
                {
                    Logs.Err("Could not properly upload file {1} to SFTP Server {0}. Exception: {2}\n{3}", host, fullFileName, e.Message,e.StackTrace);
                    return false;
                }
            }
        }

I see the message indicating Connected, uploading file.... but the process just hangs there. This is with a 19k file. With a 100k file the upload works perfectly.

Rich


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>