Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

Is there a particular vb.net class that would allow me to run a program using telnet to log into the particular server i want to access without making the user deal with telnet? Basically, I want a button on a vb form that when clicked, runs a program that is stored on a server you can access through telnet.

 

Thanks.

  • Administrators
Posted

If you want to connect to a remote telnet server you should have a look under System.Net.Sockets.

The TCPClient class will allow you to open a connection to the telnet server and obtain a stream. You can then send / receive data quite easily.

What language would you be coding in?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Im trying somthing similiar I think.

 

See if this is any help

 

This will connect to a machine and read the inital text sent back, and store it in a log file

 

Imports System.Net.Sockets

Imports System.Net

Imports System.Text

 

 

Module Module1

 

Sub Main()

Dim tcpClient1 As New TcpClient()

Dim NS As NetworkStream

Dim bytes(tcpClient1.ReceiveBufferSize) As Byte

Dim hostaddr1 As IPAddress = IPAddress.Parse("127.0.0.1")

Dim MyEndPoint1 As New IPEndPoint(hostaddr1, 23)

Dim buffsize As Integer

Dim buff2 As String

FileOpen(1, "C:\logfile.txt", OpenMode.Output)

tcpClient1.Connect(MyEndPoint1)

NS = tcpClient1.GetStream

ReDim bytes(tcpClient1.ReceiveBufferSize)

buffsize = CInt(tcpClient1.ReceiveBufferSize)

If NS.DataAvailable Then

NS.Read(bytes, 0, buffsize)

buff2 = Encoding.ASCII.GetString(bytes)

Print(1, buff2)

End If

FileClose(1)

End Sub

End Module

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...