Problem in connecting VB.NET App to UNIX Box

vipul_tilak

New member
Joined
Jul 20, 2007
Messages
3
Programming Experience
1-3
Hi All,
I am facing some problems in my project. The scenario is described below:

I have to make a GUI on VB.Net 2005 and from that GUI I have to first login to some UNIX box and then fire commands from that GUI to the UNIX box. I have to also call some shell scripts stored in that UNIX box.
More detailed scenario: User runs the VB application and click on a button. On clicking of a button VB application should login to UNIX box and fire the commands automatically. For e.g. I have a shell script in UNIX box but I don’t know the method to login and call that shell script from VB.NET Application.

Can anybody help me out…………………….pleaseeeeeeeeeee ?

I have used the file at the following link:
http://www.c-sharpcorner.com/Upload...rticleID=a8e0e439-14df-4d82-82ee-8cb4c110f9a0

In this they have given us a C# API to telnet to some m/c and fire commands.
But whenever I try to login the string that I am getting is “??_??_??#??'??$”.
I am not getting what is it so can’t proceed.

I have a function waitfor(“login: ”) (where login is the prompt which I will get after telnet). This will wait for “login: ” on the telnetted machine and then fire some command. But that prompt is not coming.

The code that I am using is:
Module Module1

Sub Main()
Dim ip As String = "xx.xx.xx.xx"
Dim port As Integer = 23
Dim timeout As Integer = 100
'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
'connected sucessfully
Dim startingPrompt As Integer = session.WaitFor("login:")
If startingPrompt = 0 Then
'the username prompt was found so we send the username
'and wait to receive our password prompt
session.SendAndWait("vvvv", "password: ")
'now send the password and wait for our next prompt
'in this sample I expect to receive a success message
session.SendAndWait("vvvv", "$")
Else
Console.WriteLine("Username prompt was not found")
End If
Else
Console.WriteLine("Unable to connect to the server")
End If
End Sub
End Module


Above program is a Console Program. Once this is done I can convert it to GUI programming, API anyone can download from the gven path.
Please help me in developing this……..

Big Thanks in advance J
 
Back
Top