<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>sshnet Issue Tracker Rss Feed</title><link>http://sshnet.codeplex.com/workitem/list/basic</link><description>sshnet Issue Tracker Rss Description</description><item><title>Created Unassigned: Infinite loop in SocketReadLine Method [1582]</title><link>http://sshnet.codeplex.com/workitem/1582</link><description>First of all you are doing a great job, Thank&amp;#39;s for that. &lt;br /&gt;Where was an infinite loop ,do &amp;#123;..&amp;#125; while &amp;#123;.. buffer&amp;#91;buffer.Count - 1&amp;#93; &amp;#61;&amp;#61; 0x0A ...&amp;#125; condition wasn&amp;#39;t true, and a i get exception SshOperationTimeoutException&amp;#40;&amp;#34;Socket read operation has timed out&amp;#34;&amp;#41;, that was strange, i changed condition to &lt;br /&gt;while &amp;#40;&amp;#33;&amp;#40;buffer.Count &amp;#62; 0 &amp;#38;&amp;#38; &amp;#40;buffer&amp;#91;buffer.Count - 1&amp;#93;.Equals&amp;#40;0x0A&amp;#41; &amp;#124;&amp;#124; buffer&amp;#91;buffer.Count - 1&amp;#93;.Equals&amp;#40;0x00&amp;#41; &amp;#41;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;and now everything works great. Thank one more time for your library.&lt;br /&gt;</description><author>zolotoych</author><pubDate>Tue, 21 May 2013 12:24:51 GMT</pubDate><guid isPermaLink="false">Created Unassigned: Infinite loop in SocketReadLine Method [1582] 20130521122451P</guid></item><item><title>Commented Issue: Exception thrown on disconnect [1561]</title><link>http://sshnet.codeplex.com/workitem/1561</link><description>If SshClient.Disconnect&amp;#40;&amp;#41; is called just after the connected server is no longer available an exception occurs. Looks like there is a race condition on calling Disconnect. Checks are made for a connection before a DisconnectMessage is sent to the server but the server could be disconnected in between the time that the connection check is done and the message is sent. I have a scenario where this can happen quite easily.  &lt;br /&gt;&lt;br /&gt;I understand that I could put a try catch around the SshClient.Disconnect call but it seems like the better place for the try catch would be in the session class where the disconnect message is being sent.  If an exception is thrown during a disconnect it could just be ignored.&lt;br /&gt;Comments: ** Comment from web user: winkledumpling ** &lt;p&gt;I believe this is the same issue as&lt;br&gt;https://sshnet.codeplex.com/workitem/1581&lt;/p&gt;</description><author>winkledumpling</author><pubDate>Mon, 20 May 2013 06:24:36 GMT</pubDate><guid isPermaLink="false">Commented Issue: Exception thrown on disconnect [1561] 20130520062436A</guid></item><item><title>Commented Issue: Unhandled exception during SftpClient Dispose [1581]</title><link>http://sshnet.codeplex.com/workitem/1581</link><description>We are facing an unhandled exception during Dispose of the SftpClient. &lt;br /&gt;&lt;br /&gt;2013-05-13 12&amp;#58;54&amp;#58;22,711 &amp;#91;2&amp;#93; FATAL - AppDomain.UnhandledException&lt;br /&gt;Renci.SshNet.Common.SshConnectionException&amp;#58; Client not connected.&lt;br /&gt;   at Renci.SshNet.Session.SendMessage&amp;#40;Message message&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.SftpClient.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.BaseClient.Finalize&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;This happens when the connection to the Ssh server is lost and affects our ability to gracefully handle situations when servers&amp;#47;connectivity goes down. O&lt;br /&gt;&lt;br /&gt;The solution I suggest to swallow any exceptions coming from SftpClient.Dispose&amp;#40;&amp;#41; as follows. Not pretty but as a general rule, Dispose shouldnt be throwing exceptions, unless such exceptions are symtomatic of a more serious problem.&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;&lt;br /&gt;        protected override void Dispose&amp;#40;bool disposing&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            try&lt;br /&gt;            &amp;#123;&lt;br /&gt;                if &amp;#40;this._sftpSession &amp;#33;&amp;#61; null&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    this._sftpSession.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                    this._sftpSession &amp;#61; null&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;&lt;br /&gt;                if &amp;#40;this._disposeConnectionInfo&amp;#41;&lt;br /&gt;                    &amp;#40;&amp;#40;IDisposable&amp;#41;this.ConnectionInfo&amp;#41;.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;                base.Dispose&amp;#40;disposing&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;            catch&lt;br /&gt;            &amp;#123;&lt;br /&gt;                &amp;#47;&amp;#47; swallow it&lt;br /&gt;            &amp;#125;&lt;br /&gt;        &amp;#125;&lt;br /&gt;Comments: ** Comment from web user: Mister_Goodcat ** &lt;p&gt;Hi. I think your problem, that of user &amp;quot;pmilin&amp;quot; and mine are similar and/or related, see:&lt;/p&gt;&lt;p&gt;https://sshnet.codeplex.com/workitem/1561&lt;/p&gt;&lt;p&gt;In my case, I am _not_ able to solve the problem with catching exceptions (for details see the above work item).&lt;/p&gt;</description><author>Mister_Goodcat</author><pubDate>Fri, 17 May 2013 16:46:30 GMT</pubDate><guid isPermaLink="false">Commented Issue: Unhandled exception during SftpClient Dispose [1581] 20130517044630P</guid></item><item><title>Commented Issue: Exception thrown on disconnect [1561]</title><link>http://sshnet.codeplex.com/workitem/1561</link><description>If SshClient.Disconnect&amp;#40;&amp;#41; is called just after the connected server is no longer available an exception occurs. Looks like there is a race condition on calling Disconnect. Checks are made for a connection before a DisconnectMessage is sent to the server but the server could be disconnected in between the time that the connection check is done and the message is sent. I have a scenario where this can happen quite easily.  &lt;br /&gt;&lt;br /&gt;I understand that I could put a try catch around the SshClient.Disconnect call but it seems like the better place for the try catch would be in the session class where the disconnect message is being sent.  If an exception is thrown during a disconnect it could just be ignored.&lt;br /&gt;Comments: ** Comment from web user: Mister_Goodcat ** &lt;p&gt;Hi. &lt;/p&gt;&lt;p&gt;I seem to have the same or at least a related problem, however the consequences are a lot more fatal on my end. Scenario here:&lt;/p&gt;&lt;p&gt;* I connect to a remote server to invoke a command that gracefully shuts down the services there and then turns off the device (it's a NAS). That means that the SSH service is shut down on the server side when I'm still connected.&lt;br&gt;* On the client, I see two things: first of all the callback of the asynchronously executed command is never invoked, which I think is not expected. I would expect the command to finish and throw an exception when I invoke the EndExecute method in my callback. The only possibility to get notified about the disconnect is to hook the ErrorOccurred event on the client.&lt;br&gt;* When I try to Disconnect() or Dispose() in that event handler, I seem to get the same race condition, however in my case execution simply hangs and never continues (looks like a dead lock to me, haven't looked at the actual code).&lt;/p&gt;&lt;p&gt;This behavior is fatal on my dev machine when I debug my code in Visual Studio 2012: execution hangs as soon as I invoke Disconnect(), and when I then stop debugging (Shift+F5) __Windows 8 crashes with a BSOD__ telling me the process has still locked pages. I could reproduce this behavior three times in a row after clean reboots.&lt;/p&gt;&lt;p&gt;Running the application outside of Visual Studio does not result in a BSOD, however the thread my code executes on simply dies and never recovers until the process is shut down.&lt;/p&gt;&lt;p&gt;I still think your library is an excellent project and would like to thank you for it; if you could fix that problem, it would be perfect for my use case.&lt;/p&gt;&lt;p&gt;-Peter&lt;/p&gt;</description><author>Mister_Goodcat</author><pubDate>Fri, 17 May 2013 16:41:59 GMT</pubDate><guid isPermaLink="false">Commented Issue: Exception thrown on disconnect [1561] 20130517044159P</guid></item><item><title>Closed Issue: Unobserved exception rethrown by finalizer thread [1298]</title><link>http://sshnet.codeplex.com/workitem/1298</link><description>Hi,&amp;#160;There is an unhandled System.AggregateException in a worker thread within SSH.NET version 18974 that causes the container application to crash. The exception should be caught and rethrown to the caller. This error occurs when the connection between the SHH client and server is flaky, i.e. it comes on and off. I added an AppDomain unhandled exception handler to log the exception. Here is the stack trace of the exception&amp;#58;&amp;#160;ERROR&amp;#58; SubsystemSession.cs&amp;#40;128&amp;#41;&amp;#58; Object reference not set to an instance of an object.ERROR&amp;#58; SubsystemSession.cs&amp;#40;169&amp;#41;&amp;#58; Renci.SshNet.Sftp.SubsystemSession.Session_ErrorOccured&amp;#40;Object sender, ExceptionEventArgs e&amp;#41; failed.ERROR&amp;#58; System.EventHandler&amp;#96;1.Invoke&amp;#40;Object sender, TEventArgs e&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;1929&amp;#41;&amp;#58; Renci.SshNet.Session.RaiseError&amp;#40;Exception exp&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;1592&amp;#41;&amp;#58; Renci.SshNet.Session.MessageListener&amp;#40;&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;522&amp;#41;&amp;#58; Renci.SshNet.Session.b__14&amp;#40;&amp;#41; failed.ERROR&amp;#58; System.Threading.Tasks.Task.InnerInvoke&amp;#40;&amp;#41; failed.ERROR&amp;#58; System.Threading.Tasks.Task.Execute&amp;#40;&amp;#41; failed.ERROR&amp;#58; A Task&amp;#39;s exception&amp;#40;s&amp;#41; were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.ERROR&amp;#58; Application domain unhandled exception.&amp;#160;I am not too familar with Tasks, but I suspect the error could be fixed by adding a catch block to the try block at Session.cs, line 520, and rethrow the exception. I am posting this while I am trying to fix the issue in case someone else can help.&amp;#160;Thanks,&amp;#160;Robert&lt;br /&gt;</description><author>jsf75</author><pubDate>Thu, 16 May 2013 12:14:07 GMT</pubDate><guid isPermaLink="false">Closed Issue: Unobserved exception rethrown by finalizer thread [1298] 20130516121407P</guid></item><item><title>Closed Feature: File Transfer Progress [1324]</title><link>http://sshnet.codeplex.com/workitem/1324</link><description>&amp;#42;&amp;#42; Added Issue as status PROPOSED type FEATURE &amp;#42;&amp;#42;This is a discussion thread.&amp;#160;Is there any interest in including a way to expose current transfer progress to an application&amp;#63;&amp;#160;For example, imagine a user wanting to upload a file could pass in an implementation of&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;public interface IFileTransferHandler&amp;#123;    ulong BytesRead &amp;#123; get&amp;#59; &amp;#125;&amp;#160;    void IncrementBytesRead&amp;#40;ulong bytes&amp;#41;&amp;#59;&amp;#160;    void TransferCompleted&amp;#40;&amp;#41;&amp;#59;&amp;#125;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Whenever the callback for Write returns confirming that the bytes were written, IncrementReadBytes would be called and whenever the file is fully uploaded TransferCompleted gets called. Since we&amp;#39;re passing in streams, there&amp;#39;s no objective way to determine the file size so that would have to be provided in the implementation, if at all.&amp;#160;All you really need to do is add a field for that interface in SftpFileStream and then pass it to all calls to RequestWrite and then create some new constructors so that the interface can be passed along from the publicly exposed methods &amp;#40;I&amp;#39;ve managed to build a sample implementation for sftp upload, so this method works&amp;#41;. The only issue is if the handler throws an exception. Since it&amp;#39;s asynchronous the debugger displays the stack trace in the wrong place and could confuse developers.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:06 GMT</pubDate><guid isPermaLink="false">Closed Feature: File Transfer Progress [1324] 20130516121406P</guid></item><item><title>Closed Issue: SCP : Missing files when using DirectoryUpload [1382]</title><link>http://sshnet.codeplex.com/workitem/1382</link><description>Hi,I have the following environment&amp;#58;- Win7 &amp;#47; 64- .NET 3.5- MPC-Target &amp;#58;OpenSSH_6.0p1, OpenSSL 1.0.0j 10 May 2012- SSH.NET commit 19813I want to upload a directory structure &amp;#40;recursive, depth &amp;#61; 2&amp;#41; from the PC to a MPC basedLinux remote system. The total amount of data is about 8MB with 23 files from55 bytes to 4MB.Calling mScp.Upload&amp;#40;new DirectoryInfo&amp;#40;localDir&amp;#41;, remoteDir&amp;#41; does not result anyerror and the Uploading event shoes uploading all files. But after Upload&amp;#40;&amp;#41; returnedThere are a random number of missing files on the target &amp;#40;between 1 and 5&amp;#41;.It tried the same with a PC based Linux as target what resulted in the same behaviour&amp;#40;OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011&amp;#41;. It seems theproblem is caused anywhere within SSH.NET.Does anyone have a solution&amp;#63;Extension&amp;#58;I tried to workaround by replacing Upload&amp;#40;new DirectoryInfo&amp;#40;...&amp;#41;&amp;#41; by several singlecalls of Upload&amp;#40;new FileInfo&amp;#40;...&amp;#41;&amp;#41;. This worked but is too slow for my application.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:05 GMT</pubDate><guid isPermaLink="false">Closed Issue: SCP : Missing files when using DirectoryUpload [1382] 20130516121405P</guid></item><item><title>Closed Issue: Dispose() should not leave running threads behind! [1436]</title><link>http://sshnet.codeplex.com/workitem/1436</link><description>Hi. I have found a really hard to find bug that is very consistently repeatable. Before getting into the details, I think it should be noted that this issue will be resolved if the Renci.SshNet.SshClient.Dispose&amp;#40;&amp;#41; and the Renci.SshNet.ForwardedPortLocal.Dispose&amp;#40;&amp;#41; &amp;#40;and anything else&amp;#41; actually and honestly dispose everything. But the problem is that after calling those, there are still threads hanging around doing stuff and sometimes they get stuck badly. It looks like someone went crazy with anonymous methods and launching Thread Tasks without leaving a handle to the Thread for management by the parents to kill them when disposed. And I found in Session.NET40.cs this line&amp;#58;            Task.Factory.StartNew&amp;#40;action, TaskCreationOptions.LongRunning&amp;#41;&amp;#59;which I changed to&amp;#58;            Task.Factory.StartNew&amp;#40;action, TaskCreationOptions.AttachedToParent&amp;#41;&amp;#59;but it had no positive impact.I have seen posts on this site about Disconnect doing funny stuff and also about the Timeouts not seeming to disconnect things, and some other things like that. I bet they are related to getting over your head in multi-threading or events.The result is that sometimes I still have the process listening on the local port way after the Dispose&amp;#40;&amp;#41; is called. And also the Connection is sitting there too.  Usually this happens when eliminating both the Forwards and the Connection, but sometimes even just the Forwards. The call to the Forward&amp;#39;s Disconnect&amp;#40;&amp;#41; and Dispose&amp;#40;&amp;#41; when the problem happens will take a much longer time, but then sadly continue going after seemingly giving up.When I pause I can see 2 Renci threads hanging around and stuck at these points&amp;#58;ForwardedPortLocal.NET.cs line 34&amp;#58;                        var socket &amp;#61; this._listener.AcceptSocket&amp;#40;&amp;#41;&amp;#59;Session.cs line 1575&amp;#58;                    var message &amp;#61; this.ReceiveMessage&amp;#40;&amp;#41;&amp;#59;I have tested this A LOT&amp;#33;&amp;#33;&amp;#33; trying to find ways around it. It happens in the code base &amp;#40;pulled today 12&amp;#47;5&amp;#47;12&amp;#41;, it happens in .Net 4.0 DLL from a month ago, and it happens from .Net 3.5 DLL pulled today also. Another result is that sometimes the situation causes the app to die a horrible death with&amp;#58;System.AggregateException was unhandled  Message&amp;#61;A Task&amp;#39;s exception&amp;#40;s&amp;#41; were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.  Source&amp;#61;mscorlib  StackTrace&amp;#58;       at System.Threading.Tasks.TaskExceptionHolder.Finalize&amp;#40;&amp;#41;  InnerException&amp;#58; System.NullReferenceException       Message&amp;#61;Object reference not set to an instance of an object.       Source&amp;#61;Renci.SshNet       StackTrace&amp;#58;            at Renci.SshNet.ForwardedPortLocal.b__0&amp;#40;&amp;#41;            at System.Threading.Tasks.Task.InnerInvoke&amp;#40;&amp;#41;            at System.Threading.Tasks.Task.Execute&amp;#40;&amp;#41;WHEN DOES THIS HAPPEN&amp;#58;Here is the kicker.  I wrote an app to manage SSH tunnels. And when I first was having problems with Renci, I made it so I can implement other libraries and other means. Via a config file I can add and remove tunnels and have multiple connections. The process reads the config file periodically and applies the changes found. So I can have a connection using Renci, another using Chilkat, another using Plink, Tunnelier, and that&amp;#39;s all I finished implementing so far.If I have all Renci connections, it seems that I can add and remove tunnels and connections a bunch of times and not have an issue. &amp;#40;however usually there is a Connection &amp;#40;SshClient&amp;#41; that hangs around in CLOSE_WAIT state&amp;#41;. If I bring say Chilkat into the mix, things still are OK.. and I can replace all active connections to one of the other implementations.The problems start happening when I bring in Plink or Tunnelier. They are launched using System.Process. They close themselves properly from what I see in memory and via TCP connections and SSH server. When I have a Renci and Plink &amp;#40;let&amp;#39;s say&amp;#41; connection, it is then that if I start removing tunnels from Renci I might have issues. If I start removing the Connection, I almost always have an issue.The issue is that when Renci is told to close up shop, it stalls for a while, and then the code moves on while leaving the listeners in place &amp;#40;though of course not working&amp;#41;. And they stay there it seems indefinitely. And I&amp;#39;m also using System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties&amp;#40;&amp;#41;.GetActiveTcpListeners&amp;#40;&amp;#41; to look at the listeners and it&amp;#39;s there. It&amp;#39;s because there are those silly Renci threads that are hanging around for some reason trying to read from the socket.And I have verified that the Connection replacement &amp;#40;like Plink&amp;#41; is not actually opening up that tunnel. I have my app now specifically checks for the Active listeners before moving tunnels to another connection.This may be a very complicated specific bug to find, but I think the real root of the problem and the much easier one to fix, is that when you Dispose&amp;#40;&amp;#41;, it really should be DISPOSED, leaving no threads behind. I have also verified that calling SshClient.Dispose&amp;#40;&amp;#41; does not DISCONNECT, so you have to call both. I think also similar thing with the Forward.. if you don&amp;#39;t call Stop&amp;#40;&amp;#41;.This is how I stop the connections and port forwards&amp;#58;            foreach &amp;#40;ForwardedPort forward in this.sshConnection.ForwardedPorts.ToList&amp;#40;&amp;#41;&amp;#41;            &amp;#123;                this.sshConnection.RemoveForwardedPort&amp;#40;forward&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished removing tunnel&amp;#34;&amp;#41;&amp;#59;            &amp;#125;            this.sshConnection.Disconnect&amp;#40;&amp;#41;&amp;#59;            Console.WriteLine&amp;#40;&amp;#34;just finished conn Disconnect&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;            this.sshConnection.Dispose&amp;#40;&amp;#41;&amp;#59;            Console.WriteLine&amp;#40;&amp;#34;just finished conn Dispose&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;        public void Dispose&amp;#40;&amp;#41;        &amp;#123;            if &amp;#40;this.localForward &amp;#33;&amp;#61; null&amp;#41;            &amp;#123;                this.localForward.Stop&amp;#40;&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished tunnel Stop&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;                this.localForward.Dispose&amp;#40;&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished tunnel Disconnect&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;                &amp;#47;&amp;#47;System.Threading.Thread.Sleep&amp;#40;2000&amp;#41;&amp;#59;            &amp;#125;        &amp;#125;&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:04 GMT</pubDate><guid isPermaLink="false">Closed Issue: Dispose() should not leave running threads behind! [1436] 20130516121404P</guid></item><item><title>Closed Issue: Invalid handling of http proxy server response [1509]</title><link>http://sshnet.codeplex.com/workitem/1509</link><description>Hi,&lt;br /&gt;&lt;br /&gt;I did find a problem when testing the assembly with our squid 3.0 proxy. I receive the message, that Result cannot be called on a failed match. Therefore I&amp;#39;ve extended the code in Session.cs a little bit&amp;#58;&lt;br /&gt; &lt;br /&gt;                if &amp;#40;statusCode &amp;#61;&amp;#61; 200 &amp;#38;&amp;#38; string.IsNullOrEmpty&amp;#40;response&amp;#41;&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    &amp;#47;&amp;#47;  Once all HTTP header information is read, exit&lt;br /&gt;                    break&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;                else&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    string reasonPhrase &amp;#61; string.Empty&amp;#59;&lt;br /&gt;&lt;br /&gt;                    try&lt;br /&gt;                    &amp;#123;&lt;br /&gt;                        if &amp;#40;match.Success&amp;#41;&lt;br /&gt;                            reasonPhrase &amp;#61; match.Result&amp;#40;&amp;#34;&amp;#36;&amp;#123;reasonPhrase&amp;#125;&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    &amp;#125;&lt;br /&gt;                    catch &amp;#40;Exception ex&amp;#41;&lt;br /&gt;                    &amp;#123;&lt;br /&gt;                        reasonPhrase &amp;#61; string.Empty&amp;#59;&lt;br /&gt;                    &amp;#125;&lt;br /&gt; &lt;br /&gt;Now the following line&lt;br /&gt;&lt;br /&gt;throw new ProxyException&amp;#40;string.Format&amp;#40;&amp;#34;HTTP&amp;#58; Status code &amp;#123;0&amp;#125;, Reason &amp;#92;&amp;#34;&amp;#123;1&amp;#125;&amp;#92;&amp;#34;&amp;#34;, statusCode, reasonPhrase&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;Does at least return the error code &amp;#40;not yet the fault reason&amp;#59; in this case ERR_ACCESS_DENIED&amp;#41;&lt;br /&gt;&lt;br /&gt;In fact the code received a 403 status code from the proxy&amp;#58;&lt;br /&gt;&lt;br /&gt;SshNet.Logging Verbose&amp;#58; 1 &amp;#58; Initiating connect to &amp;#39;yyy.xxx.zzz.ww&amp;#58;22&amp;#39;.&lt;br /&gt;&lt;br /&gt;HTTP&amp;#47;1.0 403 Forbidden&lt;br /&gt;Server&amp;#58; squid&amp;#47;3.0.STABLE16-RC1&lt;br /&gt;Mime-Version&amp;#58; 1.0&lt;br /&gt;Date&amp;#58; Wed, 13 Feb 2013 14&amp;#58;15&amp;#58;06 GMT&lt;br /&gt;Content-Type&amp;#58; text&amp;#47;html&lt;br /&gt;Content-Length&amp;#58; 1008&lt;br /&gt;Expires&amp;#58; Wed, 13 Feb 2013 14&amp;#58;15&amp;#58;06 GMT&lt;br /&gt;X-Squid-Error&amp;#58; ERR_ACCESS_DENIED 0&lt;br /&gt;X-Cache&amp;#58; MISS from app-proxy-3.xxxx.xxx&lt;br /&gt;Via&amp;#58; 1.0 app-proxy-3.xxxx.xxx &amp;#40;squid&amp;#47;3.0.STABLE16-RC1&amp;#41;&lt;br /&gt;Proxy-Connection&amp;#58; close&lt;br /&gt;&lt;br /&gt;The thread 0xa2c has exited with code 0 &amp;#40;0x0&amp;#41;.&lt;br /&gt;&lt;br /&gt;Kind regards&lt;br /&gt;&lt;br /&gt;Johannes&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:00 GMT</pubDate><guid isPermaLink="false">Closed Issue: Invalid handling of http proxy server response [1509] 20130516121400P</guid></item><item><title>Closed Issue: SCP Can't Upload Rooted Directories [1511]</title><link>http://sshnet.codeplex.com/workitem/1511</link><description>As per the discussion &amp;#91;here&amp;#93;&amp;#40;http&amp;#58;&amp;#47;&amp;#47;sshnet.codeplex.com&amp;#47;discussions&amp;#47;284021&amp;#41;, SCP doesn&amp;#39;t currently work when uploading rooted folders.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:00 GMT</pubDate><guid isPermaLink="false">Closed Issue: SCP Can't Upload Rooted Directories [1511] 20130516121400P</guid></item><item><title>Closed Issue: Process terminated due to unhandled exception in Finalize / Destructor [1514]</title><link>http://sshnet.codeplex.com/workitem/1514</link><description>__My application encountered the following unhandled exception that caused the process to exit&amp;#58;__&lt;br /&gt;&lt;br /&gt;Framework Version&amp;#58; v4.0.30319&lt;br /&gt;Description&amp;#58; The process was terminated due to an unhandled exception.&lt;br /&gt;Exception Info&amp;#58; Renci.SshNet.Common.SshConnectionException&lt;br /&gt;Stack&amp;#58;&lt;br /&gt;  at Renci.SshNet.Session.SendMessage&amp;#40;Renci.SshNet.Messages.Message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.SendMessage&amp;#40;Renci.SshNet.Messages.Connection.ChannelCloseMessage&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Finalize&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;__This occurred just over 60 seconds _after_ the Dispose method on SftpClient was called which generated a very similar exception &amp;#40;handled and logged by my code&amp;#41;&amp;#58;__&lt;br /&gt;&lt;br /&gt;2013-02-16 15&amp;#58;41&amp;#58;32.9693 Error SftpFileTransfer Renci.SshNet.Common.SshConnectionException,Client not connected.,  at Renci.SshNet.Session.SendMessage&amp;#40;Message message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.SendMessage&amp;#40;ChannelCloseMessage message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.SftpClient.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.BaseClient.Dispose&amp;#40;&amp;#41;&lt;br /&gt;  at BusinessObjects.SftpFileTransfer.DownloadFiles&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;__It looks like &amp;#126;SubsystemSession&amp;#40;&amp;#41; is causing an attempt to send a message over the channel&amp;#40;&amp;#33;&amp;#41; due to the chaining of calls to the various Dispose&amp;#40;&amp;#41; methods.__&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:13:59 GMT</pubDate><guid isPermaLink="false">Closed Issue: Process terminated due to unhandled exception in Finalize / Destructor [1514] 20130516121359P</guid></item><item><title>Closed Issue: Orphaned threads when port forwarding [1522]</title><link>http://sshnet.codeplex.com/workitem/1522</link><description>I&amp;#39;m not sure if this is the same issue as &amp;#91;here&amp;#93;&amp;#40;http&amp;#58;&amp;#47;&amp;#47;sshnet.codeplex.com&amp;#47;workitem&amp;#47;1436&amp;#41;.&lt;br /&gt;&lt;br /&gt;In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected &amp;#40;by pulling out the cable&amp;#41; and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.&lt;br /&gt;&lt;br /&gt;With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever &amp;#40;well at least until a kill -9 is issued&amp;#41;&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;System.Threading.WaitHandle.WaitAny&amp;#40;new WaitHandle&amp;#91;&amp;#93; &amp;#123; this._channelEof &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;System.Threading.WaitHandle.WaitAny&amp;#40;new WaitHandle&amp;#91;&amp;#93; &amp;#123; this._channelEof &amp;#125;, 5000&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;After that, the inner thread exits properly and no more hangs on exit.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:13:59 GMT</pubDate><guid isPermaLink="false">Closed Issue: Orphaned threads when port forwarding [1522] 20130516121359P</guid></item><item><title>Created Issue: Unhandled exception during SftpClient Dispose [1581]</title><link>http://sshnet.codeplex.com/workitem/1581</link><description>We are facing an unhandled exception during Dispose of the SftpClient. &lt;br /&gt;&lt;br /&gt;2013-05-13 12&amp;#58;54&amp;#58;22,711 &amp;#91;2&amp;#93; FATAL - AppDomain.UnhandledException&lt;br /&gt;Renci.SshNet.Common.SshConnectionException&amp;#58; Client not connected.&lt;br /&gt;   at Renci.SshNet.Session.SendMessage&amp;#40;Message message&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.SftpClient.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.BaseClient.Finalize&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;This happens when the connection to the Ssh server is lost and affects our ability to gracefully handle situations when servers&amp;#47;connectivity goes down. O&lt;br /&gt;&lt;br /&gt;The solution I suggest to swallow any exceptions coming from SftpClient.Dispose&amp;#40;&amp;#41; as follows. Not pretty but as a general rule, Dispose shouldnt be throwing exceptions, unless such exceptions are symtomatic of a more serious problem.&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;&lt;br /&gt;        protected override void Dispose&amp;#40;bool disposing&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            try&lt;br /&gt;            &amp;#123;&lt;br /&gt;                if &amp;#40;this._sftpSession &amp;#33;&amp;#61; null&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    this._sftpSession.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                    this._sftpSession &amp;#61; null&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;&lt;br /&gt;                if &amp;#40;this._disposeConnectionInfo&amp;#41;&lt;br /&gt;                    &amp;#40;&amp;#40;IDisposable&amp;#41;this.ConnectionInfo&amp;#41;.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;                base.Dispose&amp;#40;disposing&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;            catch&lt;br /&gt;            &amp;#123;&lt;br /&gt;                &amp;#47;&amp;#47; swallow it&lt;br /&gt;            &amp;#125;&lt;br /&gt;        &amp;#125;&lt;br /&gt;</description><author>winkledumpling</author><pubDate>Tue, 14 May 2013 08:03:59 GMT</pubDate><guid isPermaLink="false">Created Issue: Unhandled exception during SftpClient Dispose [1581] 20130514080359A</guid></item><item><title>Created Issue: Wrong PKCS7 padding in DES algorithm [1580]</title><link>http://sshnet.codeplex.com/workitem/1580</link><description>public class PKCS7Padding &amp;#58; CipherPadding&lt;br /&gt;    &amp;#123;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;summary&amp;#62;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; Transforms the specified input.&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;summary&amp;#62;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;param name&amp;#61;&amp;#34;blockSize&amp;#34;&amp;#62;Size of the block.&amp;#60;&amp;#47;param&amp;#62;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;param name&amp;#61;&amp;#34;input&amp;#34;&amp;#62;The input.&amp;#60;&amp;#47;param&amp;#62;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;returns&amp;#62;&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; Padded data array.&lt;br /&gt;        &amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;returns&amp;#62;&lt;br /&gt;        public override byte&amp;#91;&amp;#93; Pad&amp;#40;int blockSize, byte&amp;#91;&amp;#93; input&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            var numOfPaddedBytes &amp;#61; blockSize - &amp;#40;input.Length &amp;#37; blockSize&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            var output &amp;#61; new byte&amp;#91;input.Length &amp;#43; numOfPaddedBytes&amp;#93;&amp;#59;&lt;br /&gt;            Buffer.BlockCopy&amp;#40;input, 0, output, 0, input.Length&amp;#41;&amp;#59;&lt;br /&gt;            for &amp;#40;int i &amp;#61; 0&amp;#59; i &amp;#60; numOfPaddedBytes&amp;#59; i&amp;#43;&amp;#43;&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                &amp;#47;&amp;#47;Wrong&lt;br /&gt;                &amp;#47;&amp;#47;output&amp;#91;input.Length &amp;#43; i&amp;#93; &amp;#61; output&amp;#91;input.Length - 1&amp;#93;&amp;#59;&lt;br /&gt;&lt;br /&gt;                &amp;#47;&amp;#47;Should be like this&lt;br /&gt;                output&amp;#91;input.Length &amp;#43; i&amp;#93; &amp;#61; &amp;#40;byte&amp;#41;numOfPaddedBytes&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;&lt;br /&gt;            return output&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;</description><author>coaxhappy</author><pubDate>Tue, 14 May 2013 03:26:33 GMT</pubDate><guid isPermaLink="false">Created Issue: Wrong PKCS7 padding in DES algorithm [1580] 20130514032633A</guid></item><item><title>Created Issue: Remote File exists not working [1574]</title><link>http://sshnet.codeplex.com/workitem/1574</link><description>I&amp;#39;ve tried to use sftp.Exists&amp;#40;String&amp;#41; do not work for files. Already tested for file and for directory. Directory work well, but files are not recognized.&lt;br /&gt;</description><author>roker002</author><pubDate>Tue, 07 May 2013 13:05:20 GMT</pubDate><guid isPermaLink="false">Created Issue: Remote File exists not working [1574] 20130507010520P</guid></item><item><title>Created Issue: Need for ShellStream.Read( byte[] buffer, int offset, int count, Timespan timeout) [1565]</title><link>http://sshnet.codeplex.com/workitem/1565</link><description>Hi,&lt;br /&gt;&lt;br /&gt;Would it be possible to add the above method to the ShellStream class&amp;#63;&lt;br /&gt;&lt;br /&gt;I have an application that does a &amp;#34;read and collect until .... found&amp;#34;. During developement of the app I discovered that doing a continuous &amp;#34;if &amp;#40;shell.DataAvailable&amp;#41; shell.Read&amp;#40;...&amp;#41;&amp;#34; doesn&amp;#39;t return anything because the correct threads a not getting time to do any work.&lt;br /&gt;The waithandle that is used in the ShellStream class isn&amp;#39;t publicly accessible &amp;#40;which is good&amp;#41; but this handle is required to complete my code.&lt;br /&gt;&lt;br /&gt;Below a possible implementation for this method.&lt;br /&gt;&lt;br /&gt;public override int Read&amp;#40;byte&amp;#91;&amp;#93; buffer, int offset, int count, TimeSpan timeout&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            var i &amp;#61; 0&amp;#59;&lt;br /&gt;&lt;br /&gt;            bool wait &amp;#61; false&amp;#59;&lt;br /&gt;            lock &amp;#40;this._incoming&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                wait &amp;#61; &amp;#40;this._incoming.Count &amp;#60; count&amp;#41;&amp;#59;           &lt;br /&gt;            &amp;#125;&lt;br /&gt;&lt;br /&gt;            if &amp;#40;wait&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                if &amp;#40;timeout &amp;#33;&amp;#61; null&amp;#41;&lt;br /&gt;                    this._dataReceived.WaitOne&amp;#40;timeout&amp;#41;&amp;#59;&lt;br /&gt;                else&lt;br /&gt;                    this._dataReceived.WaitOne&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;&lt;br /&gt;            lock &amp;#40;this._incoming&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                for &amp;#40;&amp;#59; i &amp;#60; count &amp;#38;&amp;#38; this._incoming.Count &amp;#62; 0&amp;#59; i&amp;#43;&amp;#43;&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    buffer&amp;#91;offset &amp;#43; i&amp;#93; &amp;#61; this._incoming.Dequeue&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;            &amp;#125;&lt;br /&gt;&lt;br /&gt;            return i&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Alternatively&amp;#59; if an Expect&amp;#40;&amp;#41; method could be written that Captures all from start of Expect until the expected is found would also be nice. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Erik&lt;br /&gt;</description><author>etamminga</author><pubDate>Thu, 02 May 2013 12:43:39 GMT</pubDate><guid isPermaLink="false">Created Issue: Need for ShellStream.Read( byte[] buffer, int offset, int count, Timespan timeout) [1565] 20130502124339P</guid></item><item><title>Created Issue: scp double quotes in file path [1564]</title><link>http://sshnet.codeplex.com/workitem/1564</link><description>Hi Oleg, &lt;br /&gt;&lt;br /&gt;I can&amp;#39;t thank you enough for a wonderful project&amp;#33;  I saw that this issue has come up before and been closed, but I found it with the 2013.4.7 release as well, so I thought I&amp;#39;d raise it again.  When using the ScpClient upload command, double quotes are added to the file path at channel.SendExecRequest&amp;#40;string.Format&amp;#40;&amp;#34;scp -rt &amp;#92;&amp;#34;&amp;#123;0&amp;#125;&amp;#92;&amp;#34;&amp;#34;, pathParts&amp;#91;0&amp;#93;&amp;#41;&amp;#41;.  The double quotes are not needed for the Solaris 10 system I was trying to connect to.  Using the command just created files and directories with quotes in the names on the UNIX server instead of placing the files in the directory I had requested.  Removing the double quotes fixed the problem and the command worked exactly as expected.&lt;br /&gt;&lt;br /&gt;Thanks again.&lt;br /&gt;</description><author>KateNorton</author><pubDate>Tue, 30 Apr 2013 16:28:35 GMT</pubDate><guid isPermaLink="false">Created Issue: scp double quotes in file path [1564] 20130430042835P</guid></item><item><title>Created Issue: OverflowException on empty server response [1562]</title><link>http://sshnet.codeplex.com/workitem/1562</link><description>Hello,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m trying to connect to OS X Mountain Lion from a Windows Phone 7.5 application using a SFTP client implemented using your library &amp;#40;version 2013.4.7&amp;#41;, and upon sftpclient.connect, after a few seconds of it apparently waiting for something, it crashes with OverflowException. Debugging in the source code the OverflowException is thrown in line 88&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;response &amp;#61; encoding.GetString&amp;#40;buffer.ToArray&amp;#40;&amp;#41;, 0, buffer.Count - 1&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;At this point buffer.Count &amp;#61; 0, so buffer.Count -1 is actually -1.&lt;br /&gt;&lt;br /&gt;Looking up it did break at&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;                &amp;#47;&amp;#47;  If zero bytes received then exit&lt;br /&gt;                if &amp;#40;args.BytesTransferred &amp;#61;&amp;#61; 0&amp;#41;&lt;br /&gt;                    break&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;However in the subsequent tests that case doesn&amp;#39;t seem handled&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;            if &amp;#40;buffer.Count &amp;#62; 0 &amp;#38;&amp;#38; buffer&amp;#91;buffer.Count - 1&amp;#93; &amp;#61;&amp;#61; 0x00&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                response &amp;#61; string.Empty&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;            else if &amp;#40;buffer.Count &amp;#62; 1 &amp;#38;&amp;#38; buffer&amp;#91;buffer.Count - 2&amp;#93; &amp;#61;&amp;#61; 0x0D&amp;#41;&lt;br /&gt;                response &amp;#61; encoding.GetString&amp;#40;buffer.ToArray&amp;#40;&amp;#41;, 0, buffer.Count - 2&amp;#41;&amp;#59;&lt;br /&gt;            else&lt;br /&gt;                response &amp;#61; encoding.GetString&amp;#40;buffer.ToArray&amp;#40;&amp;#41;, 0, buffer.Count - 1&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;So I added a simple line as follows and now I do get the &amp;#34;Server string is null or empty&amp;#34; exception as expected&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;            if &amp;#40;buffer.Count &amp;#62; 0 &amp;#38;&amp;#38; buffer&amp;#91;buffer.Count - 1&amp;#93; &amp;#61;&amp;#61; 0x00&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                response &amp;#61; string.Empty&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;            if &amp;#40;buffer.Count &amp;#61;&amp;#61; 0&amp;#41; response &amp;#61; string.Empty&amp;#59; &amp;#47;&amp;#47; &amp;#60;-- this line right here&lt;br /&gt;            else if &amp;#40;buffer.Count &amp;#62; 1 &amp;#38;&amp;#38; buffer&amp;#91;buffer.Count - 2&amp;#93; &amp;#61;&amp;#61; 0x0D&amp;#41;&lt;br /&gt;                response &amp;#61; encoding.GetString&amp;#40;buffer.ToArray&amp;#40;&amp;#41;, 0, buffer.Count - 2&amp;#41;&amp;#59;&lt;br /&gt;            else&lt;br /&gt;                response &amp;#61; encoding.GetString&amp;#40;buffer.ToArray&amp;#40;&amp;#41;, 0, buffer.Count - 1&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;</description><author>northernlights</author><pubDate>Sun, 28 Apr 2013 14:31:38 GMT</pubDate><guid isPermaLink="false">Created Issue: OverflowException on empty server response [1562] 20130428023138P</guid></item><item><title>Commented Issue: Forwarded Port channels can get stuck waiting [1558]</title><link>http://sshnet.codeplex.com/workitem/1558</link><description>I was testing ssh.net with 2 ForwardedPortLocals.  When a connection is established, a port is forwarded properly but the channel is sometimes not closed, depending on how the local port was closed.&lt;br /&gt;&lt;br /&gt;It can get stuck waiting for an EOF that never comes in ChannelDirectTcpip.cs Bind&amp;#40;&amp;#41;&lt;br /&gt; System.Threading.WaitHandle.WaitAny&amp;#40;new WaitHandle&amp;#91;&amp;#93; &amp;#123; this._channelEof &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;this is because the while loop above can exit gracefully if _socket.CanRead&amp;#40;&amp;#41; returns false.  In this scenario no CloseMessage was ever sent so it will sit waiting forever.  I suggest adding&amp;#58;&lt;br /&gt;&lt;br /&gt;this.SendMessage&amp;#40; new ChannelCloseMessage&amp;#40; this.RemoteChannelNumber &amp;#41; &amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;after the while loop or moving the WaitAny line into Close&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;Comments: ** Comment from web user: nlewis ** &lt;p&gt;A fix for the second problem is to dispose the _socket in ChannelDirectTcpip.cs in OnErrorOccurred and OnDisconnected.  Disposing the socket will ensure that the call to _socket.CanRead() which lets the thread exit and also informs the locally connected client that the socket is dead.&lt;/p&gt;</description><author>nlewis</author><pubDate>Fri, 26 Apr 2013 15:29:31 GMT</pubDate><guid isPermaLink="false">Commented Issue: Forwarded Port channels can get stuck waiting [1558] 20130426032931P</guid></item><item><title>Created Issue: Exception thrown on disconnect [1561]</title><link>http://sshnet.codeplex.com/workitem/1561</link><description>If SshClient.Disconnect&amp;#40;&amp;#41; is called just after the connected server is no longer available an exception occurs. Looks like there is a race condition on calling Disconnect. Checks are made for a connection before a DisconnectMessage is sent to the server but the server could be disconnected in between the time that the connection check is done and the message is sent. I have a scenario where this can happen quite easily.  &lt;br /&gt;&lt;br /&gt;I understand that I could put a try catch around the SshClient.Disconnect call but it seems like the better place for the try catch would be in the session class where the disconnect message is being sent.  If an exception is thrown during a disconnect it could just be ignored.&lt;br /&gt;</description><author>pmilin</author><pubDate>Tue, 23 Apr 2013 17:35:05 GMT</pubDate><guid isPermaLink="false">Created Issue: Exception thrown on disconnect [1561] 20130423053505P</guid></item></channel></rss>