Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb6 code for opening telnet 1

Status
Not open for further replies.

roelmcebu

Technical User
Feb 14, 2004
27
PH
I made a VB code that will access a remote machine thru Reflection2. My problem is if the PC that is running my code has no Reflection2 installed it cannot execute the program.

What is the code or object that I will use to use telnet running in windowsXP/2000.

My code for opening Reflection2
Dim Ref2 as Reflection2.Application
.
.
.
set Ref2 = createobject("Reflection2.Application")
...

Can anyone share idea on how to utilize(vb code) the telnet service in windows? I don't like to use Reflection2 anymore because it is not installed in all our PCs unlike 'TELNET'.

thanks.
 
Ugh. No, I think he wants to try to automate an instance of the Windows Telnet.EXE utility.

This utility doesn't expose an automation interface at all. You can "shell" an instance of Telnet.EXE but it won't do you a lot of good. There are no properties or methods to manipulate it with, and you can't control it by redirecting standard I/O streams to anonymous pipes because it does I/O against the console device (rather than reading/writing stdin and stdout).

You really only have one option: a Telnet control.

You can Google for these (search on expressions like [tt]Telnet ActiveX Client[/tt]) or you can try to roll your own based on the Winsock control. You might find a bit of usable VB6 Telnet client code out there someplace that could be repackaged as a UserControl or a Class.

If the server(s) you want to connect to are "dumb" enough (many *nix "Telnet" servers are really raw TCP servers) then a Winsock control alone might work fine.


If you do want to go the "fire up an EXE and control it via piped standard I/O" route you might consider the freeware PLink.EXE utility instead. It is made to be "scripted" in such a manner.

See: Chapter 7: Using the command-line connection tool Plink

Of course if you don't have experience running and controlling an external process from VB6 you'll have some more stuff to learn. That or look for yet another ActiveX component like a "ShellPipe" control designed for just this purpose.

The Microsoft Scripting Runtime can be used from a VB6 program in some cases to do this. It lacks an event model though so it isn't a great choice unless blocking ReadLine() calls will meet your needs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top