E.V.I.C.T.  B.V.
Edwin Vermeer Information Communication Technology.
Google
 
Web SITESKINNER.COM



home / open source software / Telnet

Your browser does not support webstandards: please upgrade your browser before proceding.(klick here for more information about web standards)

Telnet

This library let you interact with a host using the Telnet protocol. You can send any command and get the data that is returned by it. It is also posible to react on the events that are triggered.

My personal favourite is a 'tail -f' command on a log file. This will look like the host is trigering an event in your Visual Basic application. I have such an application running in my Windows service for months.

Warning : All data received will be added to the Telnet.ReceivedData property. If you let it run for a long time (you received 1MB) the performance will go down considerably. If you do not need to save the data in memory then just clear this property in the DataReceived or LineReceived event. You can do that right after you have handeled the data.

Click here to download the complete source code, the compiled DLL and the demo.

How you can use the EVICT_Telnet.dll

Public WithEvents Telnet As Telnet
Private Sub btnStart_Click()
   Set Telnet = New Telnet
   Telnet.TelnetHost = "mytelnethost.com"
   Telnet.TelnetPort = 23
   Telnet.UserName = :MyUsername"
   Telnet.Password = "MySecretPassword"
   Telnet.LoginPrompt = "$"
   Telnet.PassWordPrompt = "Password:"
   Telnet.Prompt = vbLf & "$"
   Telnet.Login
   Telnet.Command "ls -l"
   Telnet.Logout
   Set Telnet = Nothing
End Sub

Private Sub Telnet_LineReceived(strData As String)
  ' Put here code to process the data for the command.
  Debug.Print strData
  ' Just clear the buffer after each line so that we
  ' will not use more memory than neccessery.
  Telnet.ReceivedData = ""
End Sub
 
Cool! Planet-source-code
Thums up! Get Firefox! Valid HTML 4.01! Valid CSS!