From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview TCP to replace telnet

Hi,  i face strange issue with using labview TCP function.

 

im trying to communicate with my DUT, in manual way we will use telnet or putty to just telnet 192.168.1.1 

 

then type user name, hit ENTER

type password, hit ENTER

then we can send command and see the feedback to configure the DUT.

 

i had tried 3 different telnet client, command prompt, putty and Procomm, it work perfect as expected, only labview TCP have problem, i attached the screen shot of command prompt,

 

i truely dont understand why labview TCP READ will return ÿýÿý ÿý#ÿý'  instead of login: or Password:

the TCP write does not give error, however i have no way to verify whether it is ok if i cannot TCP READ anything.

 

i did some google search, many people say TCP is direct replacement for telnet, local national instrument staff also said TCP VISA can replace telnet. i may had missed out very simple settings or something, but i could not figure it out.

 

do you guys seen such situation before? please help

Thank you

 

 

 

Download All
0 Kudos
Message 1 of 11
(5,698 Views)

Hi Mr_Chin,

I think the characters you are reading are Telnet command characters sent by the DUT which is expecting a partner who will implement the Telnet protocol.  I recommend using Hyperterminal to connect to the DUT; use the "Microsoft Message Analyzer" (W/provider="Microsoft-PEF-NDIS-PacketCapture") to watch the messages passed back and forth.  It's possible to open a "raw" TCP socket and emulate a Telnet device (I've done it); the Telnet protocol is well documented!

 

Cheers.

0 Kudos
Message 2 of 11
(5,652 Views)

FYI:

In this thread you'll find a link to an LLB called LV_COMM.llb.

The "Dvr.MCD.vi" lets you open a connection, send strings and receive responses from a telnet host.

Dvr.MCD.vi spawns a process (Dmn.NVT.d.r.vi) to manage the connection.

I'm not recommending that you use this code!  I only mention it because it does demonstrate how Telnet is built on a "raw" TCP socket.Smiley Happy

 

Cheers!

0 Kudos
Message 3 of 11
(5,634 Views)

If you read through the RFCs for Telnet, there are a bunch of option codes.  It is likely the server is expecting a confirmation of the options before allowing for the login process.  If you set your string indicator to Hex format and post that information, I can give better explanation.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(5,607 Views)

Dear Crossrulz,

 

i set to HEX and it show this

FFFD 18FF FD20 FFFD 23FF FD27 

 

and this output only appear when i try to TCP write the "login name" after TCP open connection;

if i directly TCP read after TCP open connection, it will display nothing.

0 Kudos
Message 5 of 11
(5,592 Views)

Just for fun, try sending 0xFFF1.  This will send a NOP command.  But it might be enough to have the server start to look at your data.

 

0xFFFD18 = DO Terminal Type (refer to RFC1091)

0xFFFD20 = DO Terminal Speed (refer to RFC1079)

0xFFFD23 = DO X Display Location (refer to RFC1096)

0xFFFD27 = DO New Environment Option (refer to RFC 1572)

 

I have not read up on those RFCs yet, but my guess is that they won't matter unless the server is actually looking for a response.  If that is the case, then you need to send 0xFFFBYY where YY is the last byte from the DO commands.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(5,586 Views)

i wrote HEX constant to TCP write, and it return error 60.

0 Kudos
Message 7 of 11
(5,559 Views)

@jackson_thom wrote:

i wrote HEX constant to TCP write, and it return error 60.


That error is a connection issue.  It should not be coming from sending a message on an established connection.  Did you fail to close your connection or have it open by another application?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 11
(5,551 Views)

I'm experiencing the same issue, with the exception of the write error.  Was a solution found?

 

This issue started when my company switched over to a Linux OS.  Is there something different for Linux?

 

I attached images of the code.

Download All
0 Kudos
Message 9 of 11
(5,222 Views)

Let me be a little more clear.  The device that I'm trying to connect to has changed to a Linux OS, the host remains the same. 

 

There is a direct connection via Ethernet from the host to the device.  I'm able to connect using the command prompt and PUTTY via telnet. 

 

I appreciate the help in advance. 

CRM

0 Kudos
Message 10 of 11
(5,219 Views)