How to Use Telnet With VB6

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

Telnet clients connect to a server on the Internet or within your local network; so you can configure the server from your desktop. You can create your own Telnet client using the Visual Basic 6 language. You must use the Telnet client control, which is a part of the VB6 compiler.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Click the Windows "Start" button, and type "visual basic 6" in the search text box. Press "Enter" to open the Visual Basic software.

  2. 2

    Click the "Project" menu item, and select "References." A list of ActiveX components you can insert into your program is displayed. Check the box labelled "ActiveSocket" and click "OK" to add it to your project.

  3. 3

    Right-click the VB code file you want to use to connect to the Telnet server. Click "View Code." Type the following code to create a Telnet class variable:

    Public telnet As ASOCKETLib.Tcp

    Set telnet = CreateObject("ActiveXperts.Tcp")

  4. 4

    Create the Telnet connection. The following code makes a connection to the server "tserver" on port 23, which is the default Telnet server port:

    telnet.Connect "tserver", 23

  5. 5

    Send a command to the server. You use the "SendText" function to send a command to the server. The following code sends the "dir" command, which lists the files and directories on the server:

    telnet.SendString "dir"

  6. 6

    Close the connection to the server. After you finish sending commands to the server, you must close the connection to complete the service. Use the following code to close the connection:

    telnet.Disconnect

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.