基于MinimalisticTelnet改进,目前自己够用了
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
namespace ZY.Net
{
public class TelnetClient
{
private TcpClient Client;
private NetworkStream ns;
private string m_LogonPrompt = "ogin:";
private string m_PasswordPrompt = "assword:";
private readonly int BuffSize = 1024 * 4;
/// <summary>
/// 登录输入用户名提示字符
/// 默认值:ogin:
/// </summary>
public string LoginPrompt
{
set { m_LogonPrompt = value; }
get { return m_LogonPrompt; }
}
/// <summary>
/// 登录输入密码提示字符
/// 默认值:assword:
/// </summary>
public string PasswordPrompt
{
set { m_PasswordPrompt = value; }
get { return m_PasswordPrompt; }
}
/// <summary>
/// 连接状态
/// </summary>
public bool Connected
{
get { return Client != null ? Client.Connected : false; }
}
/// <summary>
/// 连接远端主机
/// </summary>