Hi, I am trying to write a simple telnet client using VB.NET with Visual Studio 2005.
I am using System.Net.Sockets.
But I cant make it work yet.
What I need is:
To automate some tasks on UNIX server.
To achieve this, I need to login to unix (from within my app.) via telnet, and run some commands.
Thats all.
Anyone can help me with this
Thanks
Fede.

writing a Telnet client with VB. NET
ManuelT
Ok. The first thing you should do is make sure the downloaded project compiles ok. Then create a new project, I would do just a Console app for testing, add a reference to the .dll file and then do something like the following:
Imports
objActiveSolutionsModule
Module1 Sub Main() Dim ip As String = "66.xx.xx.xx" Dim port As Integer = 23 Dim timeout As Integer = 10'create the object supplying the parameters
Dim session As New ScriptingTelnet(ip, port, timeout) Dim connected As Boolean = session.Connect() 'try to connect If connected = True Then Dim startingPrompt As Integer = session.WaitFor("Username:") If startingPrompt = 0 Then "testuser", "Password:")'now send the password and wait for our next prompt
'in this sample I expect to receive a success message
session.SendAndWait(
"testpassword", "Success") Else "Username prompt was not found") End If Else "Unable to connect to the server") End If End SubEnd
ModuleI hope you get the feel of how to use this component to script your session.
AndyPham
JeevesIndia
eldiener
B.Huard
jasmine pham
This code does not work for me either. It does not seem to be sending messages properly.
Clemens Vasters - MSFT
Guys,
I don't know what is going on here. I was in the same situation you were all in until I found that component. I gave it a shot and it just worked. I have no clue why it worked for me and not for you all. Now, there are other components out there can can script telnet sessions; but of course they are not free. Good luck you all.
DaveZJ
I am having the same issue as well. I copied and pasted the prompt for "Username: " from the telnet window that I have, but it still does not work.
Anyone have any ideas
Thanks,
Eric
Abualnassr
selvan_06
Jake.K
yes,
I'am Using
System.Net.Sockets
tcpClient
By now i succeeded to connect to the unix server.
I recieve this as a response: " ↑ ▼ # ' ".
I tried to parse it with Encoding.Ascii without success. I dont get anything.
How to negotiate the authentication process
Thanks
Fede
WinstonPennypacker
kaynos
Hey,
Download this sample from
http://www.c-sharpcorner.com/UploadFile/tylerkline/TelnetScripting11282005001158AM/TelnetScripting.aspx ArticleID=a8e0e439-14df-4d82-82ee-8cb4c110f9a0
Its just 1 source file that will compile to an assemply and you can use its public methods to script your telnet session. I had the same issue where I had to script a telnet session for a cisco interface using telnet. You may have to register to download the sample.
If your not able to figure it out, let me know and I can post some sample code.
kawing0510
Hello,
This is a very good control.
But how can I simulate "Enter" command into terminal
Thanks