You asked for it, you've got it! A Telnet UserControl that supports an asynchronous processing model.
All clean, original code. Nothing copied from... well you know those other projects! The event model is similar to that of the Winsock control itself.
The TelnetTTYClient UserControl is presented here within a simple Telnet client "TTY terminal" project. See the TelnetTTYClient.ctl and modDoc.bas source comments for more information.
You can add the TelnetTTYClient UserControl to your projects by copying TelnetTTYClient.ctl and TelnetTTYClient.ctx to your project folder and adding TelnetTTYClient.ctl to your project (Add|File... in Project Explorer).
Note that using a TTY terminal type as in the sample project can be useful in avoiding the need to parse out VTxxx escape sequences.
Last edited by dilettante; Dec 25th, 2007 at 11:50 PM.
Minor update, will not affect most programs but may add some stability. Can mostly just drop-into any existing Projects you have. Primary difference you might see is in the Enum TTC_ERRORS, passed to your client logic via the Error event.
Nice to get a 5 year update just 2 weeks before I need it :-) What timing! Nice perfectly working model; thanks. Do you have any examples coded where this can be used to send commands to tty and "screen scrape" to get the response or is it all in here and I just need to wade through it? (I am always extremely lazy when possible :-) Also is there a way to instigate a keep alive for a 60 second time out from the server? Thanks!!!
Sorry, I don't have any examples that parse server response messages... that's pretty wide open since every application would be so different. The process is plain old parsing though, using Split(), and InStr(), or regex.
Also I can't find any examples of communicating via SSH TTY other than with ActiveX controls that cost more than small automobiles, way out of the range of most hobbyists. Do you know of anything that has been constructed using common VB6 offerings? Thank you.
I think I understand the problem: creating a VB6 program that does much the same kind of thing but over an SSH session (not Telnet through an SSH tunnel, but Secure Shell itself).
No I haven't seen anything that does that, and yes the prices are fairly high for good (or any) SSH ActiveX components.
I do have a kind of "hillbilly" solution I have used in the past for that kind of thing as well as SFTP, FTPS, and straight FTP:
Find a free client EXE for the protocol that supports redirection of the StdIO streams. For SSH this might be PuTTY or PLink. Then I use my ShellPipe control in the VB6 program to run this utility and automate it via the ShellPipe.
As always, the biggest headache is parsing the responses. Well... maybe after you get any required SSH keys configured on the client PC of course, but sometimes you can live without those keys anyway depending on the server.
just a quick question... i pulled your tty code into one of my projects so I could see how a tty terminal would integrate. it seems to work well except for a couple of items. I am sending one particular command to a server that is supposed to return the following:
LOADING PROGRAM VERSION 5.31-0
FlexiBSC ATBSC071 2013-01-15 20:54:39
PCM SERVICE STATE PAGE 1
ET-3079 PCM OK
when using my other terminal programs, i get all the way to "command executed", but with yours it stops as "page 1". any idea why? i have poured through the code and I cant find anything that would block it. Most of the other commands i send work ok, but this one is kinda coming up short... ??? Is there some replace$ function or something that might be filtering out the response and preventing it from getting into the terminal window?
Anything is possible but to diagnose this you'd probably need to log the raw traffic being sent over TCP.
Telnet has a pretty wide range of commands and responses, and your server may be sending one and hanging awaiting the response to it.
You'll probably need to add logic to log everything being received and sent and review that. Your logging code will need to log the data in both HEX and characters since Telnet commands are made up of non-text information exchanged between the server and client intermixed with textual data.
sounds like a lot more trouble than what i care to go through for 1 lost line . thanks though. i will try to find that data through another command... besides, the only thing that i was trying to extract from that response is the status of the circuit..."OK" which i think i can get from somewhere else... thanks for the tty code though... it certainly saved me a lot of time in developing my project.