0

Cisco デバイスとの telnet セッションを確立し、デバイスの応答に応じてコマンドを送信する必要があります。

私は試した:

ヘッダー:

using System.Net;
using System.Net.Sockets;

コード:

TelnetConnection tc = new TelnetConnection("gobelijn", 23);
Telnet t = new Telnet();

どちらもうまくいきません!

次のエラーが表示されます。

The type or namespace name 'TelnetConnection' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Telnet' could not be found (are you missing a using directive or an assembly reference?)

私はここで完全に道に迷っており、サポートが必要です。

また、Telnet ではなく SSH を使って簡単に接続する方法があれば教えてください。

アップデート

アンドレアスが述べたことに従いましたが、今はエラーが発生しています:

System.Exception: Failed to connect : no login prompt
at ciscoManager.TelnetConnection.Login(String Username, String Password, Int32 LoginTimeOutMs)
at ciscoManager.Program.Main(String[] args)

私のコードでは、「Enter」キーを押して送信しようとしていますが、喜び\r\nもありませんでした!\n

助けが必要!

4

1 に答える 1

3

私が覚えている限り、 norにはTelnetConnectionorTelnetクラスはありません。System.NetSystem.Net.Sockets

ただし、不足している部分を提供するオープン ソース プロジェクトがいくつかあります。

Telnet の場合: http://telnetexpect.codeplex.com

SSH の場合: http://sshnet.codeplex.com

于 2013-05-18T15:10:26.207 に答える