04-13-2010 11:29 AM
Hi,
I am using CVI 7.1, and test out the inet sample application on Unix server. It works, and I was able to telnet, send a comand, etc... I then connect the app to an electrical unit, which run VxWork. After providing the host ip address, the application returns the prompt "->". Then, I send a command "d" or any other command, the InetTelnetRead function fail to read any data responsed from the Telnet session. The error return is 0, which is fine. The byteRead is always 0.
Please help me. I just take the exact inet sample, do not modify anything. Not sure that there are some special case for my box running VxWork.
static void ReadResponse (void)
{
int error = 0, bytesRead, totalBytesRead = 0;
char response[128];
// Read response from telnet server and update user interface
while (1)
{
bytesRead = 0;
error = InetTelnetRead (gTelnetHandle, response, sizeof (response) - 1,
&bytesRead, 100);
if (bytesRead == 0 && totalBytesRead > 0)
break;
totalBytesRead += bytesRead;
ProcessResponse (response);
SetCtrlVal (gPanel, PANEL_RESPONSE, response);
}
}
04-13-2010 04:20 PM
It has been a while since I worked on any VxWorks target systems but I seem to recall that there is something quirky about the way it handles telnet sessions. (And FTP sessions for that matter).
The problem you are seeing is almost definitely a clash between what telnet options the VxWorks server supports and what the CVI client wants.
The telnet protocol has a large number of options, including a setting for echoing back what was sent. The options are all negotiated between the hosts at connection time and that is all handled behind the scenes in the NI Inet library where you can't get to it.
Without loading up a packet sniffer like Wireshark and examining the negotiation traffic between the two applications, it is difficult to say exactly what the problem is.
I would suggest contacting WindRiver technical support about VxWorks and their telnet implementation.
http://www.windriver.com/products/vxworks/
More info on telnet protocol and options:
Telnet protocol specification http://www.faqs.org/rfcs/rfc854.html
Wikipedia article with links to all of the relevant RFC documents http://en.wikipedia.org/wiki/Telnet
A Microsoft KB page with some good info http://support.microsoft.com/kb/231866
Sorry I can't be of any further assistance. I no longer have any access to VxWorks based systems and can't go experiment on one.
04-14-2010 01:42 PM
Thanks MJF for your help.
The box that I am trying to telnet in using the CVI app is on the Rhino 10, and it does not work. I then try on a different box that run Rhino MX, and it works.... very strange. I don't know what cause the problem. I would be that there are some settings are different between the two. I will investigate it later. The things that bother me is that I am able to use a Windows Client client to connect, but the CVI app does not work with the one on Rhino 10. I look at the InetTelnetWrite function below. It would be the Line Feed or Null character added after the command string are handle differently in different version (Unix, VxWork, etc...)
int CVICALLBACK CommandCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char command[256];
int error = 0;
switch (event)
{
case EVENT_COMMIT:
SetWaitCursor (1);
// Get command string and write to telnet server
GetCtrlVal (panel, control, command);
SetCtrlVal (panel, control, "");
error = InetTelnetWrite (gTelnetHandle, command, "\r\n", -1, 0, 5000);
//error = InetTelnetWrite (gTelnetHandle, command, "\0\n", -1, 0, 5000);
ResetTextBox (gPanel, PANEL_RESPONSE, "");
// Read telnet response
ReadResponse ();
SetWaitCursor (0);
break;
}
return 0;
}