c# - Opening Telnet Sessions to Cisco Device -


i need establish telnet session cisco device , send commands depending on device reply.

i tried:

headers:

using system.net; using system.net.sockets; 

code:

telnetconnection tc = new telnetconnection("gobelijn", 23); telnet t = new telnet(); 

both doesn't work!

i these errors:

the type or namespace name 'telnetconnection' not found (are missing using directive or assembly reference?) type or namespace name 'telnet' not found (are missing using directive or assembly reference?) 

i'm totally lost here , need support.

also, if there simple way connect using ssh not telnet, kindly provide.

update

i've followed andreas stated down, i'm getting error:

system.exception: failed connect : no login prompt @ ciscomanager.telnetconnection.login(string username, string password, int32 logintimeoutms) @ ciscomanager.program.main(string[] args) 

in code, i'm trying send "enter" key press using \r\n , tried \n no joy!

need help!

as far remember there no telnetconnection or telnet class in system.net nor system.net.sockets.

there few open source projects providing missing pieces:

for telnet: http://telnetexpect.codeplex.com

for ssh: http://sshnet.codeplex.com 🍺 https://nuget.org/packages/ssh.net/
or http://granados.sourceforge.net

edit: found tutorial, did not add needed dependencies project.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -