Witam,
Mam 2 pytania:
- jaką polecacie najbardziej rozwiniętą biblioteke pod SSH
- W jaki sposób zrobic taką konsole w WinForm - jako User Control lub Component.
Witam,
Mam 2 pytania:
Nie wiem czy polecam, ale http://sshnet.codeplex.com/ SSH.NET wygląda na dobrą.
Jak zrobić - stworzyć user control, najprościej pewnie wrzucić na niego jakiś textbox z czarnym tłem i białym tekstem (skoro ma być "konsola"), i przekazywać informacje tam i z powrotem przez SSH.
Hmm korzystam z niej lecz ma problem z rozłączaniem i wytwala exception . Jesli nacisnę przycisk z disconnect to jest ok. jesli natomiast zrobie w evencie ClosingForm rozłączenie SSH i po tym ApplicationExit(), to wywala exception w bibliotece:
Fragment funckji z Ssh.NET:
try
{
var receivedBytes = this._socket.Receive(buffer, receivedTotal, length - receivedTotal, SocketFlags.None);
if (receivedBytes > 0)
{
// signal that bytes have been read from the socket
// this is used to improve accuracy of Session.IsSocketConnected
_bytesReadFromSocket.Set();
receivedTotal += receivedBytes;
continue;
}
// 2012-09-11: Kenneth_aa
// When Disconnect or Dispose is called, this throws SshConnectionException(), which...
// 1 - goes up to ReceiveMessage()
// 2 - up again to MessageListener()
// which is where there is a catch-all exception block so it can notify event listeners.
// 3 - MessageListener then again calls RaiseError().
// There the exception is checked for the exception thrown here (ConnectionLost), and if it matches it will not call Session.SendDisconnect().
//
// Adding a check for this._isDisconnecting causes ReceiveMessage() to throw SshConnectionException: "Bad packet length {0}".
//
if (_isDisconnecting)
throw new SshConnectionException("An established connection was aborted by the software in your host machine.", DisconnectReason.ConnectionLost); // Tu wywala exception
throw new SshConnectionException("An established connection was aborted by the server.", DisconnectReason.ConnectionLost);
}