David Dupont wrote:
> Has anyone created some code to access another machine using telnet? We
> have some hardware that can only be tested through a telnet port, and I
> haven't been able to figure this one out yet. I've been working with a
> telnet OCX control by Catalyst, but I think I'm missing something, because I
> can't get it to work. (The VB examples that came with the OCX control work,
> so I know the OCX is functional).
I second Craig Graham's comments about cobbling together your own solution using
the LabVIEW TCP/IP VIs. It's true that the Internet Toolkit has high-level VIs
for programmatic telnet sessions, but that might be overkill in your case. Do
consider the ITK if you plan to be doing a lot of programmatic FTP transfer or
e-mailing, and especial
ly if you want to use LabVIEW to implement CGIs.
Some details about the telnet approach:
When you say that the hardware "can only be tested through a telnet port," that
probably just means TCP/IP port 23. So, to initiate a test session to the
hardware, simply use TCP Open Connection and specify port 23 and the IP address
of the hardware.
If that VI returns without error, you've got a valid connection. The next thing
the hardware is likely to want is a username and a password to validate access.
Simply use TCP Write to send your username, wait for acknowledgement (maybe a
TCP Read looking for a character or two?), then use TCP Write again to send your
password. After this, sending commands and reading back results follows the
same pattern.
The trick is in the timing of writes and reads. Those details--and a full
implementation of the telnet protocol--is why it's easier in some cases to go
with the prewritten stuff in the ITK.
Regards,
John Lum
National Instruments