maartenvervelde Posted October 12, 2015 Share Posted October 12, 2015 Hi, I'm trying to make an HMI in visual studio using ssh. I'm using the ssh.net library but I have a problem using gpascii. Becasue it is a program which keeps running, it wont return a value because its never finished. What is the best way to use gpascii through C# in the same way you can use it in PuTTY or the IDE? Link to comment Share on other sites More sharing options...
bradp Posted October 12, 2015 Share Posted October 12, 2015 What type of return value are you looking for? When you try to open gpascii you get a string telling if it was successful or not and a terminating I believe. Then each time you send a pmac command you get the response with for new line indicator if the response is multi-line and for the end of response indicator. These are usually wrapped by users into their own functions named something like open(), GetResponse(), and Close(). Link to comment Share on other sites More sharing options...
KEJR Posted October 22, 2015 Share Posted October 22, 2015 I think Brad hit the nail on the head, but I'll just add a few things. Once you have a ssh connection as a transport established you should login, execute GPASCII which will run indefinitely as your command interpreter through stdin and stdout. I'm not familiar with that ssh library but you should be able to write and read to the port connection through a stream. Connect to the PPMAC and run GPASCII and you will see how it works. You may need to use a program like Hercules (a program you should have if you are doing serial port or TCP programming) to view the non printable ASCII characters. If your ssh library only allows you to execute single lines of shell input and expects the program to return immediately with a return code then you need to look into another ssh software. KEJR Link to comment Share on other sites More sharing options...
Recommended Posts