Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

New Post: Move a File From a selected Directory to another Directory.

$
0
0

Hi,

It seems like you doing it right but server for some reason returns "Failure" error.
It might be due to the wrong path, file does not exists, permission etc'.

might have a problem there but will need to know exact source and Dest names to try and recreate problem here.

Hope it helps,
Thanks,
Oleg


New Post: 3.5 Source Code for release 2013.1.8?

$
0
0

Hi there.

I would also like to use this for an existing .NET 3.5 project under VS2008. I have duplicated the timeout problem and verified that it does indeed work if compiled with VS2010. Then I did some debugging in VS2008.

KeyExchangeDiffieHellmanGroupExchangeSha256.cs at line 36 in the Start method, I found that the statement

 this.Session.MessageReceived += Session_MessageReceived;

seems to simply hang. Same line executes just fine in VS2010. Don't see anything wrong syntactically and Googling for weird EventHandler<T>hangs has not yielded much. Has anybody seen a problem with this construct/syntax?

Matt

New Post: 3.5 Source Code for release 2013.1.8?

$
0
0

Hi all,

Our workaround was to compile the source code in VS2010, and use that dll file in our VS2008 project. This was adequate for us, as we don't plan to change or update the code very often.

Regards,

Gerri

New Post: Move a File From a selected Directory to another Directory.

$
0
0

Thanks for your fast feedback. I can get this fix by myself.I must ste a new Name for my File in the Destination String.

But now I get an SSHConnectionException after moveing an File is that normal ? The File is moved and my Connection get Closed.

New Post: Move a File From a selected Directory to another Directory.

$
0
0

Hi,

I usually try to say what the reason for SshConnectionException. What else does it say?
Often it happens because server disconnects the connection for whatever reason. Sometimes for protocol issues which I can solve and sometimes for something else that I will need to investigate.

Thanks,
Oleg

New Post: SCP cancel upload. Possible?

$
0
0
Hi,

I have not used the library, so apologies if I have missed the obvious...

I have a need to upload large files using SCP (yea not SFTP) and looking at the ScpClient class I do not see if an upload can be cancelled. The upload looks like a synchronous call.

Is it possible?

Thx

Rob Smyth

New Post: CONNECTING to SFTP (SSH2) enable server getting System.Net.Sockets.SocketException

$
0
0
Can anybody please help! Here is the message I got when trying to connect. Here is my code:

class Program
{
    static string ip = "10.48.174.23", user = "SD_DCFS", pass = "SDdcfs_EFT";
    static int port = 22;       

    static void Main(string[] args)
    {
        SftpClient sftp = new SftpClient(ip, port, user, pass);
        sftp.Connect();            
         SshNET.Uploader(sftp, inFilePath, directoryPath, "Test.txt");
         sftp.Disconnect();
    }
 }
and here is the message I received:

System.Net.Sockets.SocketException was unhandled
Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.48.174.23:22
Source=System
ErrorCode=10060
NativeErrorCode=10060
StackTrace:
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at Renci.SshNet.Session.SocketConnect(String host, Int32 port)
   at Renci.SshNet.Session.Connect()
   at Renci.SshNet.BaseClient.Connect()
   at FTP_LAUSD.Program.Main(String[] args) in \\isdowfsv03\d350home\e542938\visual studio 2010\Projects\FTP_LAUSD\Program.cs:line 28
InnerException:

Thanks,
-bill

Created Issue: Synchronization bug in SftpClient.InternalUploadFile [1502]

$
0
0
Hi,
my name is Jacek Drozdowski I'm Senior Software Developer at Jack Wills London.
We started use SshNET library to upload files on SFTP (private key) server.

I found a bug with synchronization of reading stream (line 1501) and writing ftp request. (line 1475) in SftpClient.InternalUploadFile method.
On end of loop (line 1511) you are checking
} while (expectedResponses &gt; 0);
which is not enough because if notification from RequestWrite (1475) is faster than input.Read (1501) value of expectedResponses is equal 0 and transfer is finished without exception!!!

I had a problem with this testing my solution on local computer with local FTP server.
You can simply reproduce this bug using test in debug mode and real FTP server. Make breakpoint at line 1501 and wait for response from FTP. Result is obvious: transfer is finished without informing user about partial transfer.

Solution is very simple, please change line 1511 to:
} while (expectedResponses &gt; 0 || bytesRead &gt; 0);
because we are waiting for expected request from FTP and we are checking buffer to send as well.

Kind Regards

Jacek Drozdowski

Senior Software Developer
Jack Wills
London NW10 6DJ, UK

New Post: Testing can destroy your home

$
0
0
Hello and thank you for your hard work.

I was wondering if it's a good idea to always perform "rm -rf *" in the OnInit() method in the test cases?

I was testing the SCP upload and didn't notice it has deleted everything in my home directory. I think you can test upload/download of a file without having to wipe every document, foto and directories from the target disk. I know I'm responsible for executing someone else's code on my machine, but I lost a day of work.

At least put a warning there somewhere!

Thanks and regards

New Post: 3.5 Source Code for release 2013.1.8?

$
0
0
Good Morning.

Simply using a VS2010 compiled version is probably the right solution, as it seems several folks are doing it, but it bugged me not knowing WHY seemingly correct code worked differently between compilers.

'this.Session.MessageReceived' is declared
 internal event EventHandler<MessageEventArgs<Message>> MessageReceived;
The Visual Studio 2008 and 2010 C# compilers treat the 'event' access modifier differently. See "Visual C# 2010 Breaking Changes" at http://msdn.microsoft.com/en-us/library/ee855831(v=vs.100).aspx; it talks about changes in Event synchronization.

Looking at the CIL for the VS2008 compiled version, I see the 'synchronized' attribute on the Renci.SshNet.Session::add_MessageReceived Method. That attribute is NOT present in the VS2010 version. From the CLI standard (ECMA-335) "Synchronized methods. A lock that is visible across threads controls entry to the body of a synchronized method. For instance and virtual methods the lock is associated with the this pointer."

So basically, the 'synchronized' attribute in the VS2008 version is equivalent to 'lock(this)' on the Session object. Well, Session.Connect wraps the whole connection attempt and key exchange in a 'lock(this)', so the delegate add blocks until the key exchange attempt times out and Session.Connect exits.

The rest of the code seems to handle event synchronization in accordance with the VS2010 recommendations, so it would indeed seem safer to go with VS2010, rather than re-work it for VS2008.

Matt

New Post: Testing can destroy your home

$
0
0
Hi,

Sorry about that.
I build those test to run against my test machine which is dedicated for this purpose and I never expected anybody to run it on the server other then test or at least with the username that is not for test.
Unfortunately currently I am not aware of any other way to do it, other then tracking files that I create, but then I always can have an issue of test failing in the middle and created files never will be deleted.
I also don't know where should I put a warning for that.

Thanks,
Oleg

New Post: Testing can destroy your home

$
0
0
Hi again,

How about creating and using a special ssh.net subdirectory for testing purposes? then it can be disposed at will with rm -rf.

Or having the test files containing a special pattern in their name, then in OnInit() you could find them and delete them with "find . -type f -name *.your_pattern -print | xargs rm".

I guess it's rather improbable that people will use a dedicated machine just for tests, or that they will setup special accounts only for this, but that's my opinion and I cannot speak for all.

Thanks and best regards!

New Post: CONNECTING to SFTP (SSH2) enable server getting System.Net.Sockets.SocketException

$
0
0
Hi Oleg,

You'are absolutely right. I used the wrong IP so I wasn't able to connect. I have another quesiton. Do you have example that I can upload a DataTable instead of a text file?

Thank you so much,
-bill

New Post: CONNECTING to SFTP (SSH2) enable server getting System.Net.Sockets.SocketException

$
0
0
Hi,

No, Sorry, I do not have such example.

Thanks,
Oleg

New Post: CONNECTING to SFTP (SSH2) enable server getting System.Net.Sockets.SocketException

$
0
0
Hi Oleg,

Can I write the DataTable to a MemoryStream and then upload the MemoryStream using sftpClient.UploadFile()?

Thanks,
-bill

New Post: 3.5 Source Code for release 2013.1.8?

$
0
0
Hey Matt, Very nice work- a gold star for you! :) I hate it when circumstances like this do not have an explaination, so hats off to you sir.

Thanks, Mike

Source code checked in, #22964

$
0
0
Improve internal server window size managment Fix exception handeling when multiple threads share one channel that can caus application hanging Improve cipher perfomance Other fixes

New Post: Small File Upload Problem

$
0
0
Hi Rich,

I just committed some fixes where I improved server window management, which I think causes you a problem.
But, my suspicion it still might not work, and this is due to server specific implementation of window management.
My suspicion that it waits for window to be 0 before expanding it but I couldn't manage to handle this situation properly so far, I think, since all implementation that I have access to handle it differently.

If you think it would be possible for me to get an access to this device with some test credentials, I probably could see if I could handle this situation a little better.
But I guess for now, see if current commit fixes it, and if not I would just log it as an Issue so other people could see that and I could get back to it later.
May be someone could get me access to one of such devises in case you can not.

Thanks,
Oleg

New Post: CONNECTING to SFTP (SSH2) enable server getting System.Net.Sockets.SocketException

$
0
0
Hi,
I am sure its possible,
You can find examples of it online since its not SSH specific task.

Thanks,
Oleg

New Post: 3.5 Source Code for release 2013.1.8?

$
0
0
Hey Matt,

Thanks for finding this out.
I originally started this project in VS.NET 2010 and .NET 4.0 so wouldn't know where to look.

Thanks,
Oleg
Viewing all 2955 articles
Browse latest View live


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