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

Commented Unassigned: Backspace in ssh stream output [2570]

$
0
0
Hi, I have no issues when using SshCommand.Execute(). However, when I create a ShellStream and attach to a StreamReader object, when I submit commands I tend to get garbled output like so:

perl -e "use LWP::Simple; my @info = head(\"https://files.example.\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bfo = head(\"https://

..... snip

That is, the stream output is littered with backspaces, and the number of backspaces sometimes but don't necessarily match the number of corrections I'd expect. On the same output later, there is a case where I see X backspace characters and there truly are X "corrected" characters.

Example above: that's 64 backspace characters, but you can see that it only seems to back up 32 characters before starting from ... "fo = head" again.

Anyone have an idea about either of these?

1. Why is it doing this "correcting" at all?
2. Why don't the number of backspaces match the number of corrected characters?

Thanks much for insight anyone can provide.

P.S. I find that increasing the number of "columns" when I invoke CreateShellStream() takes care of this. I've increased from 80 columns to 1000, or even 10000, and I don't see backspaces. Anyone have thoughts about an appropriate value? Risk associated with large number of "columns"?
Comments: ** Comment from web user: drieseng **

Can you reproduce this issue consistently ?
If so, can you send me a minimal repro (both client code and server script) ?

Thanks!


New Post: SCP upload speed

$
0
0
What is your input stream reading from ? It is a local file ?
There's still an issue in UploadFile where our buffer size is automatically reduce to the size of the last read.

Assume we start with a buffer size of 32 KB (this depends on SftpClient.BufferSize and the maximum packet size of the remote channel).
Now if we attempt to read 32 KB from the input stream, but the stream only provide 1 KB.
Then we'll adjust the buffer size we use to 1 KB, which means that for the next "chunk" we'll only attempt to read 1 KB (instead of 32 KB).
I'm not saying that you're running into this, but it's worth considering.

There are still other performance optimizations possible in UploadFile, but I haven't had time yet.

As always:
It help me a lot if you could reproduce this using a public SSH server, or if you could grant me access to the server you're using (but I understand this is hard to sell).

Commented Unassigned: Backspace in ssh stream output [2570]

$
0
0
Hi, I have no issues when using SshCommand.Execute(). However, when I create a ShellStream and attach to a StreamReader object, when I submit commands I tend to get garbled output like so:

perl -e "use LWP::Simple; my @info = head(\"https://files.example.\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bfo = head(\"https://

..... snip

That is, the stream output is littered with backspaces, and the number of backspaces sometimes but don't necessarily match the number of corrections I'd expect. On the same output later, there is a case where I see X backspace characters and there truly are X "corrected" characters.

Example above: that's 64 backspace characters, but you can see that it only seems to back up 32 characters before starting from ... "fo = head" again.

Anyone have an idea about either of these?

1. Why is it doing this "correcting" at all?
2. Why don't the number of backspaces match the number of corrected characters?

Thanks much for insight anyone can provide.

P.S. I find that increasing the number of "columns" when I invoke CreateShellStream() takes care of this. I've increased from 80 columns to 1000, or even 10000, and I don't see backspaces. Anyone have thoughts about an appropriate value? Risk associated with large number of "columns"?
Comments: ** Comment from web user: washirv **

It's not 100% consistent. I just saw it again where the stream output contained instances of " \b" (whitespace followed by backspace).

One other thing -- I run commands like so:
1. Send command plus newline
2. Read response
3. Expect prompt (e.g. $, although I'm setting my own "unique" prompt to make it easy to find EOF-equivalent)

The response always contains an echo of the command I sent, the output of the command, and the prompt -- all three are expected.

But it always seems to be the command echo that contains the backspace weirdness. I'll try to paste a stub reproduction of instantiating the shell and stream, plus sample command with backspace oddities, when I get a chance.

Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: scottowa **

Hello Gert,

Sorry but I don't have a public server to reproduce this issue with.

No data at all was written to the stream - I tried replacing the filestream with a memorystream just to be sure.

I don't have access to the logs on the SSH server either.

Let me try using an old version of the library and see whether that has the same issues.

Thanks,

Adrian

Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: scottowa **

Hello,

Interesting the old version of the library - 2013.4.7 works (as in it downloads the files).

I do see two exceptions when running in Debug but these must be caught or handled as they don't cause my program to fail:

A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'Renci.SshNet.Common.SshConnectionException' occurred in Renci.SshNet.dll

Turning on Exceptions from the Debug menu - gives me:

at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Renci.SshNet.Session.SocketRead(Int32 length, Byte[]& buffer) in t:\Third Party\Renci.SshNet.2013.4.7\Renci.SshNet\Session.NET.cs:line 115

"An established connection was aborted by the software in your host machine"
ErrorCode: 10053

Continuing on this gives:

Renci.SshNet.Messages.Transport.DisconnectReason.ProtocolError

Bad packet length 663328540

at Renci.SshNet.Session.ReceiveMessage() in t:\Third Party\Renci.SshNet.2013.4.7\Renci.SshNet\Session.cs:line 819

But as I say the files (one small(42Kb) and one big(141Kb)) seemed to download correctly.

Hope this helps.

Adrian

New Post: how to send ctrl-c, ctrl-z?

$
0
0
hello,
I was unable to find a solution on how to find control key combinations
to the ssh server like ctrl-c, ctrl-z?
thanks for help

Created Unassigned: transmit data via ssh2 subsystem [2571]

$
0
0
Hi,
I need to transmit data via ssh2 subsystem connection.
How to transmit xml data after executing command "linterface"?

While i executing command "linterface" server is waiting for data input.

How to achieve it?

Some more explanation about:
"The protocol is based on the XML standard. Transmitted
data are secured via SSH data channel.

The connection is designed in a manner equivalent to the UNIX commands:
ssh -l provider_login -i provider_ssh2_private_key -p 722 217.73.17.143 -s linterface

The connection is permanent and if the interruption provider must recognize that an
interruption occurred and the connection restored. Before reconnecting provider inserts minute
break, to avoid undue congestion looping due to possible errors in communication, which would
cause the re-hang. Login - login provider and SSH public key, the provider agrees with the operator,
TM, et al. Aldobec technologies, pre-establish cooperation.

After connecting and opening a permanent bi-directional data channel SSH both sides open XML document (XML stream), which stays open throughout the connections, that is, parties ISP of the Party of TM at the beginning and send the XML declaration opens the root element: <?xml version="1.0" encoding="UTF-8"?> <stream>
which still remains open. The communication takes place inside the root element. Top XML elements (hierarchically immediately below the root element) must be closed immediately by the sender and the receiving party top elements also processed immediately."

New Post: Unreliable Expect

$
0
0
Dear Developers,

I have noticed that expect does not always works, sometimes it just skips expected text and execution blocks

I am trying to do my own expect handler in Shell_DataReceived event
in DotNet v2, please look at the source code at:
http://pastebin.com/vH9uCWNi

I am trying to use async constructs like BeginExpect

Please let me know, how can I forcibly end such BeginExpect after it is being waited by
AR.AsyncWaitHandle.WaitOne()

see:
AR = Shell.BeginExpect(New Renci.SshNet.ExpectAction(StopOnText, AddressOf F1))

Thanks for your help

New Post: Unreliable Expect

$
0
0
I need somehow to break waiting in the fragment:
         If InStr(S, StopOnText, CompareMethod.Text) > 0 Then
            'Dim AR = New Renci.SshNet.ExpectAsyncResult

            AR.AsyncWaitHandle.Close()
            Shell.EndExpect(AR)

            'Shell.Close()
        End If

New Post: Unreliable Expect

$
0
0
I fixed it by :
        If InStr(S, StopOnText, CompareMethod.Text) > 0 Then


                   System.Threading.WaitHandle.SignalAndWait(AR.AsyncWaitHandle, AR.AsyncWaitHandle, 1, False)


        End If
May be another signaling method can be used without second wait?

Btw, SignalAndWait is not always reached, IMHO it indicates unreliability of expect

Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: drieseng **

Adrian,

What software (and version) is your SSH server running ?
You can use SftpClient.ConnectionInfo.ServerVersion to get this information.

Have you tried debugging 2014.4.6.0 beta 1 yet ?

Gert

Source code checked in, #40794

$
0
0
Channel: * Improve robustness of channels by not letting an exception - that occurs while processing events signaled by session - up to session where this would cause the message loop to interrupt, and hence the SSH client would be disconnected. Instead, exceptions that are thrown during processing of session events are now signaled using a new Exception event. * Renamed RequestSuccessed event to RequestSucceeded, fixing a typo. ChannelDirectTcpip: * Interrupt blocking receive when forwarded port is closing allowing for a clean close of the channel. * Send SSH_MSG_CHANNEL_EOF to server when client quits sending data. ChannelForwardedTcpip: * Interrupt blocking receive when forwarded port is closing or when an error occurs in the session allowing for a clean close of the channel. ForwardedPortDynamic: * When stopping the port, signal all channels that the port is closing and wait for the channels to close. * Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed. * Modify Dispose() to also interrupt blocking receive and wait for the channels to close. * Fixed IPv6 support for SOCKS5. * Signal exceptions in channels using the Exception event on the forwarded port. ForwardedPortLocal: * When stopping the port, signal all channels that the port is closing and wait for the channels to close. * Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed. * Modify Dispose() to also interrupt blocking receive and wait for the channels to close. * Signal exceptions in channels using the Exception event on the forwarded port. ForwardedPortRemote: * When stopping the port, cancel the tcpip-forward, interrupt pending channels and for the channels to close. * Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed. * Modify Dispose() to also cancel the tcpip-forward, interrupt pending channels and for the channels to close. * Signal exceptions in channels using the Exception event on the forwarded port. Overall: * Add huge set of unit tests for channels and forwarded ports.

Source code checked in, #40796

$
0
0
Immediately exit Bind when the client socket has shut down. The SSH_MSG_CHANNEL_EOF message is now only sent from Close(bool), and we now only ever wait for an SSH_MSG_CHANNEL_CLOSE message once the client has shut down. The SSH_MSG_CHANNEL_EOF which is sent by the server is now only used to interrupt the blocking receive on the client socket, and close it.

Source code checked in, #40797

Source code checked in, #40798

$
0
0
Improve robustness of client channel by not letting an exception - that occurs while processing events signaled by session - bubble up to the session where this would cause the message loop to interrupt, and hence the SSH client would be disconnected.

Source code checked in, #40799

$
0
0
Remove redundant this qualifier.

Source code checked in, #40800

$
0
0
Remove redundant this qualifier.

Source code checked in, #40801

$
0
0
Remove redundant this qualifiers.

Source code checked in, #40802

$
0
0
Added simple ServiceFactory to allow unit testing of SshClient. When disposing SshClient, make sure to stop forwarded ports before the session is closed.

New Post: Server string is null or empty

$
0
0
This will be fixed in the next beta.
See issues #1935 and #2223.
Viewing all 2955 articles
Browse latest View live


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