![](/img/trans.png)
[英]Invoking IronPython function from C# after IronPython runtime was disposed
[英]C# ShellStream disposed after certain replies by Ubuntu
我創建了自己的終端來進行 SSH 通信(renci.sshnet / C#)。 我最近遇到了一個特定於 Ubuntu SSH 的問題。
問題:
一些命令,如 'cd' 工作正常。 其他命令如 'ls' 將得到正確的答復,但之后 Shellstream 對象將被處理。 你能指出我為什么會發生這種情況的正確方向嗎?
故障排除:
private void ConnectSSH()
{
if (m_strAddr == "")
{
LaunchSSHInfoForm();
return;
}
m_Client = new SshClient(m_strAddr, m_strUser, m_strPW);
try
{
m_Client.Connect();
m_Output = m_Client.CreateShellStream("Terminal", 1, 1, 50, 50, 100);
.......
發送字符串
if (m_Client != null && m_Client.IsConnected)
{
try
{
m_Output.WriteLine(m_strInput.Text);
m_RtbParser.AddStringToQueue(m_strInput.Text, Colors.LightCoral);
m_strInput.Text = "";
}
catch (Exception ex)
{
Console.WriteLine("{0} First exception caught.", ex);
}
}
讀取字符串
if (m_Client != null && m_Client.IsConnected)
strMessage = m_Output.Read();
謝謝,任何幫助將不勝感激。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.