04-27-2015 09:50 AM
I have a TCP connection to my VI and I'm using PuTTY to communicate with it. It is a basic terminal with a few commands. On boot my first command is always unrecognized because a few TCP protocol's are sent immediately beforehand:
FF FB 1F “window size” FF FB 20 “terminal speed” FF FB 18 “terminal type” FF FB 27 “Telnet Environment Option” FF FD 01 “echo” FF FB 03 “suppress go ahead” FF FD 03 “suppress go ahead”
Each command is always proceeded by a command character "FF". I can remove the entire offending sting without any problem, however what I've been trying to do is remove any hex code following the command character. I have tried a few things with regular expressions without much luck. Any insight on how to solve this challenge would be appreciated!
Thanks,
Devin
04-27-2015 12:22 PM
One really easy solution would be to select "Raw" as the connection type instead of "Telnet" when you open PuTTY.
If that's not sufficient, it would help if you show your code. What are you trying to remove the command sequences from? I assume you have a TCP Read, you read a string, and then what? I'm not familiar with the details of the Telnet protocol, but I'd start by looking there to determine if every command has the same number of bytes (in which case you can simply skip over the appropriate number of characters), or if you need to parse the command to determine how many bytes to skip.
04-27-2015 12:41 PM
Thank you for your interest! This works for me, I'm sure it's not the most elegant way to accomplish it but It works. For the codes themselves I'm converting it from a spreadsheet string to an array and separating them by the 0xFF hex code.
04-27-2015 02:07 PM
I'm not a regular expression power user, but I'd try something like the code below (right-click on "Search and Replace String" to set the "Regular Expression" option). This code looks for \FF followed by either \F0 through FA, or \FB through \FE followed by any other character, which I think matches the rules in the Telnet protocol as listed here: http://tools.ietf.org/html/rfc854 It replaces any match found with an empty string.